Changeset 561354f for src/SynTree


Ignore:
Timestamp:
May 17, 2023, 1:33:39 AM (2 years ago)
Author:
JiadaL <j82liang@…>
Branches:
ADT
Children:
d6c464d
Parents:
28f8f15
Message:

Save progress

Location:
src/SynTree
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Declaration.h

    r28f8f15 r561354f  
    342342        enum EnumHiding { Visible, Hide } hide;
    343343
    344         std::list<StructDecl*> data_constructors;
    345         UnionDecl * data_union;
    346         EnumDecl * tags;
    347         StructDecl * tag_union;
    348 
    349344        EnumDecl( const std::string & name,
    350345         const std::list< Attribute * > & attributes = std::list< class Attribute * >(),
     
    367362};
    368363
     364class AdtDecl : public AggregateDecl {
     365        typedef AggregateDecl Parent;
     366  public:
     367        std::list<StructDecl*> data_constructors;
     368        UnionDecl * data_union;
     369        EnumDecl * tag;
     370        StructDecl * tag_union;
     371
     372        AdtDecl( const std::string & name,
     373         const std::list< Attribute * > & attributes = std::list< class Attribute * >(),
     374         LinkageSpec::Spec linkage = LinkageSpec::Cforall,
     375         const std::list< StructDecl* > data_constructors = std::list< StructDecl * >(),
     376         UnionDecl * data_union = nullptr, EnumDecl * tag = nullptr, StructDecl * tag_union = nullptr )
     377         : Parent( name, attributes, linkage ), data_constructors(data_constructors),
     378         data_union( data_union ), tag( tag ), tag_union( tag_union ) {}
     379
     380        AdtDecl( const AdtDecl & other )
     381         : Parent( other ) {}
     382
     383        virtual AdtDecl * clone() const override { return new AdtDecl( *this ); }
     384        virtual void accept( Visitor & v ) override { v.visit( this ); }
     385        virtual void accept( Visitor & v ) const override { v.visit( this ); }
     386
     387        virtual Declaration * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
     388        virtual void print( std::ostream & os, Indenter indent = {} ) const override final {
     389                os << "AdtDecl ... " << indent;
     390        }
     391       
     392private:
     393        virtual const char * typeString() const override {
     394                return "AdtDecl";
     395        }
     396};
     397
    369398class TraitDecl : public AggregateDecl {
    370399        typedef AggregateDecl Parent;
  • src/SynTree/Mutator.h

    r28f8f15 r561354f  
    3030        virtual Declaration * mutate( UnionDecl * aggregateDecl ) = 0;
    3131        virtual Declaration * mutate( EnumDecl * aggregateDecl ) = 0;
     32        virtual Declaration * mutate( AdtDecl * aggregateDecl ) = 0;
    3233        virtual Declaration * mutate( TraitDecl * aggregateDecl ) = 0;
    3334        virtual Declaration * mutate( TypeDecl * typeDecl ) = 0;
  • src/SynTree/SynTree.h

    r28f8f15 r561354f  
    3131class UnionDecl;
    3232class EnumDecl;
     33class AdtDecl;
    3334class TraitDecl;
    3435class NamedTypeDecl;
  • src/SynTree/Visitor.h

    r28f8f15 r561354f  
    3737        virtual void visit( EnumDecl * node ) { visit( const_cast<const EnumDecl *>(node) ); }
    3838        virtual void visit( const EnumDecl * aggregateDecl ) = 0;
     39        virtual void visit( AdtDecl * node ) { visit( const_cast<const AdtDecl *>(node) ); }
     40        virtual void visit( const AdtDecl * node ) = 0;
    3941        virtual void visit( TraitDecl * node ) { visit( const_cast<const TraitDecl *>(node) ); }
    4042        virtual void visit( const TraitDecl * aggregateDecl ) = 0;
Note: See TracChangeset for help on using the changeset viewer.