Changeset e67991f for src/SynTree


Ignore:
Timestamp:
Jul 16, 2019, 10:38:32 AM (6 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
6f15121
Parents:
7dc2e57b
Message:

WithStmt is now a Declaration

Location:
src/SynTree
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Declaration.h

    r7dc2e57b re67991f  
    360360};
    361361
     362class WithStmt : public Declaration {
     363public:
     364        std::list< Expression * > exprs;
     365        Statement * stmt;
     366
     367        WithStmt( const std::list< Expression * > & exprs, Statement * stmt );
     368        WithStmt( const WithStmt & other );
     369        virtual ~WithStmt();
     370
     371        virtual WithStmt * clone() const override { return new WithStmt( *this ); }
     372        virtual void accept( Visitor & v ) override { v.visit( this ); }
     373        virtual void accept( Visitor & v ) const override { v.visit( this ); }
     374        virtual Declaration * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
     375        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
     376        virtual void printShort( std::ostream & os, Indenter indent = {} ) const override { print(os, indent); }
     377};
     378
    362379class AsmDecl : public Declaration {
    363380  public:
  • src/SynTree/Expression.cc

    r7dc2e57b re67991f  
    724724}
    725725
    726 DeletedExpr::DeletedExpr( Expression * expr, BaseSyntaxNode * deleteStmt ) : expr( expr ), deleteStmt( deleteStmt ) {
     726DeletedExpr::DeletedExpr( Expression * expr, Declaration * deleteStmt ) : expr( expr ), deleteStmt( deleteStmt ) {
    727727        assert( expr->result );
    728728        result = expr->result->clone();
  • src/SynTree/Expression.h

    r7dc2e57b re67991f  
    888888public:
    889889        Expression * expr;
    890         BaseSyntaxNode * deleteStmt;
    891 
    892         DeletedExpr( Expression * expr, BaseSyntaxNode * deleteStmt );
     890        Declaration * deleteStmt;
     891
     892        DeletedExpr( Expression * expr, Declaration * deleteStmt );
    893893        DeletedExpr( const DeletedExpr & other );
    894894        ~DeletedExpr();
  • src/SynTree/Mutator.h

    r7dc2e57b re67991f  
    5252        virtual Statement * mutate( FinallyStmt * catchStmt ) = 0;
    5353        virtual Statement * mutate( WaitForStmt * waitforStmt ) = 0;
    54         virtual Statement * mutate( WithStmt * withStmt ) = 0;
     54        virtual Declaration * mutate( WithStmt * withStmt ) = 0;
    5555        virtual NullStmt * mutate( NullStmt * nullStmt ) = 0;
    5656        virtual Statement * mutate( DeclStmt * declStmt ) = 0;
  • src/SynTree/Statement.cc

    r7dc2e57b re67991f  
    493493
    494494
    495 WithStmt::WithStmt( const std::list< Expression * > & exprs, Statement * stmt ) : Statement(), exprs( exprs ), stmt( stmt ) {}
    496 WithStmt::WithStmt( const WithStmt & other ) : Statement( other ), stmt( maybeClone( other.stmt ) ) {
     495WithStmt::WithStmt( const std::list< Expression * > & exprs, Statement * stmt ) : Declaration("", noStorageClasses, LinkageSpec::Cforall), exprs( exprs ), stmt( stmt ) {}
     496WithStmt::WithStmt( const WithStmt & other ) : Declaration( other ), stmt( maybeClone( other.stmt ) ) {
    497497        cloneAll( other.exprs, exprs );
    498498}
  • src/SynTree/Statement.h

    r7dc2e57b re67991f  
    461461};
    462462
    463 class WithStmt : public Statement {
    464 public:
    465         std::list< Expression * > exprs;
    466         Statement * stmt;
    467 
    468         WithStmt( const std::list< Expression * > & exprs, Statement * stmt );
    469         WithStmt( const WithStmt & other );
    470         virtual ~WithStmt();
    471 
    472         virtual WithStmt * clone() const override { return new WithStmt( *this ); }
    473         virtual void accept( Visitor & v ) override { v.visit( this ); }
    474         virtual void accept( Visitor & v ) const override { v.visit( this ); }
    475         virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
    476         virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    477 };
     463// class WithStmt : public Statement {
     464// public:
     465//      std::list< Expression * > exprs;
     466//      Statement * stmt;
     467
     468//      WithStmt( const std::list< Expression * > & exprs, Statement * stmt );
     469//      WithStmt( const WithStmt & other );
     470//      virtual ~WithStmt();
     471
     472//      virtual WithStmt * clone() const override { return new WithStmt( *this ); }
     473//      virtual void accept( Visitor & v ) override { v.visit( this ); }
     474//      virtual void accept( Visitor & v ) const override { v.visit( this ); }
     475//      virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
     476//      virtual void print( std::ostream & os, Indenter indent = {} ) const override;
     477// };
    478478
    479479
Note: See TracChangeset for help on using the changeset viewer.