- Timestamp:
- Apr 27, 2023, 3:13:24 PM (3 years ago)
- Branches:
- ADT
- Children:
- 561354f
- Parents:
- b110bcc
- Location:
- src/AST
- Files:
-
- 4 edited
-
Convert.cpp (modified) (1 diff)
-
Decl.cpp (modified) (1 diff)
-
Decl.hpp (modified) (3 diffs)
-
Pass.impl.hpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Convert.cpp
rb110bcc r28f8f15 321 321 get<Type>().accept1(node->base) 322 322 ); 323 decl->data_constructors = get<StructDecl>().acceptL( node->data_constructors ); 324 decl->data_union = get<UnionDecl>().accept1( node->data_union ); 325 decl->tags = get<EnumDecl>().accept1( node->tag ); 326 decl->tag_union = get<StructDecl>().accept1( node->tag_union ); 323 327 return aggregatePostamble( decl, node ); 324 328 } -
src/AST/Decl.cpp
rb110bcc r28f8f15 132 132 133 133 // These must harmonize with the corresponding AggregateDecl::Aggregate enumerations. 134 static const char * aggregateNames[] = { "struct", "union", "enum", "exception", "trait", "generator", "coroutine", "monitor", "thread", "NoAggregateName" };134 static const char * aggregateNames[] = { "struct", "union", "enum", "exception", "trait", "generator", "coroutine", "monitor", "thread", "NoAggregateName", "data" }; 135 135 136 136 const char * AggregateDecl::aggrString( AggregateDecl::Aggregate aggr ) { -
src/AST/Decl.hpp
rb110bcc r28f8f15 248 248 class AggregateDecl : public Decl { 249 249 public: 250 enum Aggregate { Struct, Union, Enum, Exception, Trait, Generator, Coroutine, Monitor, Thread, NoAggregate };250 enum Aggregate { Struct, Union, Enum, Exception, Trait, Generator, Coroutine, Monitor, Thread, NoAggregate, ADT }; 251 251 static const char * aggrString( Aggregate aggr ); 252 252 … … 286 286 bool is_monitor () const { return kind == Monitor ; } 287 287 bool is_thread () const { return kind == Thread ; } 288 bool is_adt () const { return kind == ADT ; } 288 289 289 290 const Decl * accept( Visitor & v ) const override { return v.visit( this ); } … … 320 321 enum class EnumHiding { Visible, Hide } hide; 321 322 323 std::vector<ptr<StructDecl>> data_constructors; 324 bool isData = false; 325 ptr<UnionDecl> data_union; 326 ptr<EnumDecl> tag; 327 ptr<StructDecl> tag_union; 328 322 329 EnumDecl( const CodeLocation& loc, const std::string& name, bool isTyped = false, 323 330 std::vector<ptr<Attribute>>&& attrs = {}, Linkage::Spec linkage = Linkage::Cforall, 324 Type const * base = nullptr, EnumHiding hide = EnumHiding:: Hide,331 Type const * base = nullptr, EnumHiding hide = EnumHiding::Visible, 325 332 std::unordered_map< std::string, long long > enumValues = std::unordered_map< std::string, long long >() ) 326 333 : AggregateDecl( loc, name, std::move(attrs), linkage ), isTyped(isTyped), base(base), hide(hide), enumValues(enumValues) {} -
src/AST/Pass.impl.hpp
rb110bcc r28f8f15 693 693 maybe_accept( node, &EnumDecl::members ); 694 694 maybe_accept( node, &EnumDecl::attributes ); 695 maybe_accept( node, &EnumDecl::data_constructors ); 696 maybe_accept( node, &EnumDecl::data_union ); 697 maybe_accept( node, &EnumDecl::tag ); 698 maybe_accept( node, &EnumDecl::tag_union ); 695 699 } else { 696 700 maybe_accept( node, &EnumDecl::base ); … … 698 702 maybe_accept( node, &EnumDecl::members ); 699 703 maybe_accept( node, &EnumDecl::attributes ); 704 maybe_accept( node, &EnumDecl::data_constructors ); 705 maybe_accept( node, &EnumDecl::data_union ); 706 maybe_accept( node, &EnumDecl::tag ); 707 maybe_accept( node, &EnumDecl::tag_union ); 700 708 } 701 709 }
Note:
See TracChangeset
for help on using the changeset viewer.