Changeset 561354f for src/AST/Decl.hpp
- Timestamp:
- May 17, 2023, 1:33:39 AM (2 years ago)
- Branches:
- ADT
- Children:
- d6c464d
- Parents:
- 28f8f15
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Decl.hpp
r28f8f15 r561354f 248 248 class AggregateDecl : public Decl { 249 249 public: 250 enum Aggregate { Struct, Union, Enum, Exception, Trait, Generator, Coroutine, Monitor, Thread, NoAggregate, A DT};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 == A DT; }288 bool is_adt () const { return kind == Adt ; } 289 289 290 290 const Decl * accept( Visitor & v ) const override { return v.visit( this ); } … … 320 320 ptr<Type> base; // if isTyped == true && base.get() == nullptr, it is a "void" type enum 321 321 enum class EnumHiding { Visible, Hide } hide; 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 323 EnumDecl( const CodeLocation& loc, const std::string& name, bool isTyped = false, … … 350 344 }; 351 345 346 class AdtDecl final : public AggregateDecl { 347 public: 348 std::vector<ptr<StructDecl>> data_constructors; // Todo: members? 349 ptr<UnionDecl> data_union; 350 ptr<EnumDecl> tag; 351 ptr<StructDecl> tag_union; 352 353 AdtDecl( const CodeLocation& loc, const std::string& name, 354 std::vector<ptr<Attribute>>&& attrs = {}, Linkage::Spec linkage = Linkage::Cforall ) 355 : AggregateDecl( loc, name, std::move(attrs), linkage ) {} 356 357 const Decl * accept( Visitor & v ) const override { return v.visit( this ); } 358 359 const char * typeString() const override { return aggrString( Adt ); } 360 361 private: 362 AdtDecl * clone() const override { return new AdtDecl{ *this }; } 363 MUTATE_FRIEND 364 }; 365 352 366 /// trait declaration `trait Foo( ... ) { ... };` 353 367 class TraitDecl final : public AggregateDecl { … … 358 372 359 373 const Decl * accept( Visitor & v ) const override { return v.visit( this ); } 360 361 374 const char * typeString() const override { return "trait"; } 362 375
Note:
See TracChangeset
for help on using the changeset viewer.