- Timestamp:
- May 13, 2024, 10:26:52 AM (17 months ago)
- Branches:
- master
- Children:
- 31f4837
- Parents:
- 41c8312
- Location:
- src/AST
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Fwd.hpp
r41c8312 racb33f15 133 133 class OneType; 134 134 class GlobalScopeType; 135 class EnumAttrType;136 135 137 136 class Designation; -
src/AST/Pass.hpp
r41c8312 racb33f15 207 207 const ast::Type * visit( const ast::UnionInstType * ) override final; 208 208 const ast::Type * visit( const ast::EnumInstType * ) override final; 209 const ast::Type * visit( const ast::EnumAttrType * ) override final;210 209 const ast::Type * visit( const ast::TraitInstType * ) override final; 211 210 const ast::Type * visit( const ast::TypeInstType * ) override final; -
src/AST/Pass.impl.hpp
r41c8312 racb33f15 1940 1940 1941 1941 //-------------------------------------------------------------------------- 1942 // EnumAttrType1943 template< typename core_t >1944 const ast::Type * ast::Pass< core_t >::visit( const ast::EnumAttrType * node ) {1945 VISIT_START( node );1946 VISIT_END( Type, node );1947 }1948 1949 //--------------------------------------------------------------------------1950 1942 // TraitInstType 1951 1943 template< typename core_t > -
src/AST/Print.cpp
r41c8312 racb33f15 1576 1576 } 1577 1577 1578 virtual const ast::Type * visit( const ast::EnumAttrType * node ) override final {1579 preprint( node );1580 os << "enum attr ";1581 if ( node->attr == ast::EnumAttribute::Label ) {1582 os << "Label ";1583 } else if ( node->attr == ast::EnumAttribute::Value ) {1584 os << "Value ";1585 } else {1586 os << "Posn ";1587 }1588 (*(node->instance)).accept( *this );1589 return node;1590 }1591 1592 1578 virtual const ast::Type * visit( const ast::TraitInstType * node ) override final { 1593 1579 preprint( node ); -
src/AST/Type.hpp
r41c8312 racb33f15 319 319 using EnumInstType = SueInstType<EnumDecl>; 320 320 321 class EnumAttrType final : public Type {322 public:323 readonly<EnumInstType> instance;324 EnumAttribute attr;325 const Type * accept( Visitor & v ) const override { return v.visit( this ); }326 EnumAttrType( const EnumInstType * instance, EnumAttribute attr = EnumAttribute::Posn )327 : instance(instance), attr(attr) {}328 329 bool match( const ast::EnumAttrType * other) const {330 return instance->base->name == other->instance->base->name && attr == other->attr;331 }332 private:333 EnumAttrType * clone() const override { return new EnumAttrType{ *this }; }334 MUTATE_FRIEND335 };336 337 321 /// An instance of a trait type. 338 322 class TraitInstType final : public BaseInstType { -
src/AST/Visitor.hpp
r41c8312 racb33f15 119 119 virtual const ast::Type * visit( const ast::OneType * ) = 0; 120 120 virtual const ast::Type * visit( const ast::GlobalScopeType * ) = 0; 121 virtual const ast::Type * visit( const ast::EnumAttrType * ) = 0;122 121 virtual const ast::Designation * visit( const ast::Designation * ) = 0; 123 122 virtual const ast::Init * visit( const ast::SingleInit * ) = 0;
Note:
See TracChangeset
for help on using the changeset viewer.