Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Statement.h

    rba3706f r61255ad  
    3737        std::list<Label> labels;
    3838
    39         Statement( const std::list<Label> & labels = {} );
     39        Statement( std::list<Label> labels );
    4040        virtual ~Statement();
    4141
     
    5353        std::list<Statement*> kids;
    5454
    55         CompoundStmt();
     55        CompoundStmt( std::list<Label> labels );
    5656        CompoundStmt( std::list<Statement *> stmts );
    5757        CompoundStmt( const CompoundStmt &other );
     
    7070class NullStmt : public Statement {
    7171  public:
    72         NullStmt( const std::list<Label> & labels = {} );
     72        NullStmt();
     73        NullStmt( std::list<Label> labels );
    7374
    7475        virtual NullStmt *clone() const override { return new NullStmt( *this ); }
     
    8283        Expression *expr;
    8384
    84         ExprStmt( Expression *expr );
     85        ExprStmt( std::list<Label> labels, Expression *expr );
    8586        ExprStmt( const ExprStmt &other );
    8687        virtual ~ExprStmt();
     
    103104        std::list<Label> gotolabels;
    104105
    105         AsmStmt( bool voltile, Expression *instruction, std::list<Expression *> output, std::list<Expression *> input, std::list<ConstantExpr *> clobber, std::list<Label> gotolabels );
     106        AsmStmt( std::list<Label> labels, bool voltile, Expression *instruction, std::list<Expression *> output, std::list<Expression *> input, std::list<ConstantExpr *> clobber, std::list<Label> gotolabels );
    106107        AsmStmt( const AsmStmt &other );
    107108        virtual ~AsmStmt();
     
    133134        std::list<Statement *> initialization;
    134135
    135         IfStmt( Expression *condition, Statement *thenPart, Statement *elsePart,
     136        IfStmt( std::list<Label> labels, Expression *condition, Statement *thenPart, Statement *elsePart,
    136137                        std::list<Statement *> initialization = std::list<Statement *>() );
    137138        IfStmt( const IfStmt &other );
     
    157158        std::list<Statement *> statements;
    158159
    159         SwitchStmt( Expression *condition, const std::list<Statement *> &statements );
     160        SwitchStmt( std::list<Label> labels, Expression *condition, const std::list<Statement *> &statements );
    160161        SwitchStmt( const SwitchStmt &other );
    161162        virtual ~SwitchStmt();
     
    179180        std::list<Statement *> stmts;
    180181
    181         CaseStmt( Expression *conditions, const std::list<Statement *> &stmts, bool isdef = false ) throw(SemanticError);
     182        CaseStmt( std::list<Label> labels, Expression *conditions, const std::list<Statement *> &stmts, bool isdef = false ) throw(SemanticError);
    182183        CaseStmt( const CaseStmt &other );
    183184        virtual ~CaseStmt();
    184185
    185         static CaseStmt * makeDefault( const std::list<Label> & labels = {}, std::list<Statement *> stmts = std::list<Statement *>() );
     186        static CaseStmt * makeDefault( std::list<Label> labels = std::list<Label>(), std::list<Statement *> stmts = std::list<Statement *>() );
    186187
    187188        bool isDefault() const { return _isDefault; }
     
    209210        bool isDoWhile;
    210211
    211         WhileStmt( Expression *condition,
     212        WhileStmt( std::list<Label> labels, Expression *condition,
    212213               Statement *body, bool isDoWhile = false );
    213214        WhileStmt( const WhileStmt &other );
     
    234235        Statement *body;
    235236
    236         ForStmt( std::list<Statement *> initialization,
     237        ForStmt( std::list<Label> labels, std::list<Statement *> initialization,
    237238             Expression *condition = 0, Expression *increment = 0, Statement *body = 0 );
    238239        ForStmt( const ForStmt &other );
     
    263264        Type type;
    264265
    265         BranchStmt( Label target, Type ) throw (SemanticError);
    266         BranchStmt( Expression *computedTarget, Type ) throw (SemanticError);
     266        BranchStmt( std::list<Label> labels, Label target, Type ) throw (SemanticError);
     267        BranchStmt( std::list<Label> labels, Expression *computedTarget, Type ) throw (SemanticError);
    267268
    268269        Label get_originalTarget() { return originalTarget; }
     
    288289        Expression *expr;
    289290
    290         ReturnStmt( Expression *expr );
     291        ReturnStmt( std::list<Label> labels, Expression *expr );
    291292        ReturnStmt( const ReturnStmt &other );
    292293        virtual ~ReturnStmt();
     
    309310        Expression * target;
    310311
    311         ThrowStmt( Kind kind, Expression * expr, Expression * target = nullptr );
     312        ThrowStmt( std::list<Label> labels, Kind kind, Expression * expr, Expression * target = nullptr );
    312313        ThrowStmt( const ThrowStmt &other );
    313314        virtual ~ThrowStmt();
     
    331332        FinallyStmt * finallyBlock;
    332333
    333         TryStmt( CompoundStmt *tryBlock, std::list<CatchStmt *> &handlers, FinallyStmt *finallyBlock = 0 );
     334        TryStmt( std::list<Label> labels, CompoundStmt *tryBlock, std::list<CatchStmt *> &handlers, FinallyStmt *finallyBlock = 0 );
    334335        TryStmt( const TryStmt &other );
    335336        virtual ~TryStmt();
     
    357358        Statement *body;
    358359
    359         CatchStmt( Kind kind, Declaration *decl,
     360        CatchStmt( std::list<Label> labels, Kind kind, Declaration *decl,
    360361                   Expression *cond, Statement *body );
    361362        CatchStmt( const CatchStmt &other );
     
    380381        CompoundStmt *block;
    381382
    382         FinallyStmt( CompoundStmt *block );
     383        FinallyStmt( std::list<Label> labels, CompoundStmt *block );
    383384        FinallyStmt( const FinallyStmt &other );
    384385        virtual ~FinallyStmt();
     
    407408        };
    408409
    409         WaitForStmt();
     410        WaitForStmt( std::list<Label> labels = noLabels );
    410411        WaitForStmt( const WaitForStmt & );
    411412        virtual ~WaitForStmt();
     
    431432};
    432433
     434class WithStmt : public Statement {
     435public:
     436        std::list< Expression * > exprs;
     437        Statement * stmt;
     438
     439        WithStmt( const std::list< Expression * > & exprs, Statement * stmt );
     440        WithStmt( const WithStmt & other );
     441        virtual ~WithStmt();
     442
     443        virtual WithStmt * clone() const override { return new WithStmt( *this ); }
     444        virtual void accept( Visitor & v ) override { v.visit( this ); }
     445        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
     446        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
     447};
     448
    433449
    434450// represents a declaration that occurs as part of a compound statement
     
    437453        Declaration *decl;
    438454
    439         DeclStmt( Declaration *decl );
     455        DeclStmt( std::list<Label> labels, Declaration *decl );
    440456        DeclStmt( const DeclStmt &other );
    441457        virtual ~DeclStmt();
Note: See TracChangeset for help on using the changeset viewer.