Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Statement.h

    ree3c93d re67991f  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar  8 14:53:02 2018
    13 // Update Count     : 78
     12// Last Modified On : Tue Mar 12 09:01:53 2019
     13// Update Count     : 83
    1414//
    1515
     
    1919#include <list>                    // for list
    2020#include <memory>                  // for allocator
    21 #include <vector>                        // for vector
     21#include <vector>                                  // for vector
    2222
    2323#include "BaseSyntaxNode.h"        // for BaseSyntaxNode
     
    4343        const std::list<Label> & get_labels() const { return labels; }
    4444
    45         virtual Statement *clone() const override = 0;
    46         virtual void accept( Visitor &v ) override = 0;
    47         virtual Statement *acceptMutator( Mutator &m ) override = 0;
    48         virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     45        virtual Statement * clone() const override = 0;
     46        virtual void accept( Visitor & v ) override = 0;
     47        virtual void accept( Visitor & v ) const override = 0;
     48        virtual Statement * acceptMutator( Mutator & m ) override = 0;
     49        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    4950};
    5051
     
    5556        CompoundStmt();
    5657        CompoundStmt( std::list<Statement *> stmts );
    57         CompoundStmt( const CompoundStmt &other );
     58        CompoundStmt( const CompoundStmt & other );
    5859        virtual ~CompoundStmt();
    5960
     
    6263        void push_front( Statement * stmt ) { kids.push_front( stmt ); }
    6364
    64         virtual CompoundStmt *clone() const override { return new CompoundStmt( *this ); }
    65         virtual void accept( Visitor &v ) override { v.visit( this ); }
    66         virtual CompoundStmt *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    67         virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     65        virtual CompoundStmt * clone() const override { return new CompoundStmt( *this ); }
     66        virtual void accept( Visitor & v ) override { v.visit( this ); }
     67        virtual void accept( Visitor & v ) const override { v.visit( this ); }
     68        virtual CompoundStmt * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
     69        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    6870};
    6971
     
    7274        NullStmt( const std::list<Label> & labels = {} );
    7375
    74         virtual NullStmt *clone() const override { return new NullStmt( *this ); }
    75         virtual void accept( Visitor &v ) override { v.visit( this ); }
    76         virtual NullStmt *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    77         virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     76        virtual NullStmt * clone() const override { return new NullStmt( *this ); }
     77        virtual void accept( Visitor & v ) override { v.visit( this ); }
     78        virtual void accept( Visitor & v ) const override { v.visit( this ); }
     79        virtual NullStmt * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
     80        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    7881};
    7982
    8083class ExprStmt : public Statement {
    8184  public:
    82         Expression *expr;
    83 
    84         ExprStmt( Expression *expr );
    85         ExprStmt( const ExprStmt &other );
     85        Expression * expr;
     86
     87        ExprStmt( Expression * expr );
     88        ExprStmt( const ExprStmt & other );
    8689        virtual ~ExprStmt();
    8790
    88         Expression *get_expr() { return expr; }
    89         void set_expr( Expression *newValue ) { expr = newValue; }
    90 
    91         virtual ExprStmt *clone() const override { return new ExprStmt( *this ); }
    92         virtual void accept( Visitor &v ) override { v.visit( this ); }
    93         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    94         virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     91        Expression * get_expr() { return expr; }
     92        void set_expr( Expression * newValue ) { expr = newValue; }
     93
     94        virtual ExprStmt * clone() const override { return new ExprStmt( *this ); }
     95        virtual void accept( Visitor & v ) override { v.visit( this ); }
     96        virtual void accept( Visitor & v ) const override { v.visit( this ); }
     97        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
     98        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    9599};
    96100
     
    98102  public:
    99103        bool voltile;
    100         Expression *instruction;
     104        Expression * instruction;
    101105        std::list<Expression *> output, input;
    102106        std::list<ConstantExpr *> clobber;
    103107        std::list<Label> gotolabels;
    104108
    105         AsmStmt( bool voltile, Expression *instruction, std::list<Expression *> output, std::list<Expression *> input, std::list<ConstantExpr *> clobber, std::list<Label> gotolabels );
    106         AsmStmt( const AsmStmt &other );
     109        AsmStmt( bool voltile, Expression * instruction, std::list<Expression *> output, std::list<Expression *> input, std::list<ConstantExpr *> clobber, std::list<Label> gotolabels );
     110        AsmStmt( const AsmStmt & other );
    107111        virtual ~AsmStmt();
    108112
     
    114118        void set_output( const std::list<Expression *> & newValue ) { output = newValue; }
    115119        std::list<Expression *> & get_input() { return input; }
    116         void set_input( const std::list<Expression *> &newValue ) { input = newValue; }
     120        void set_input( const std::list<Expression *> & newValue ) { input = newValue; }
    117121        std::list<ConstantExpr *> & get_clobber() { return clobber; }
    118         void set_clobber( const std::list<ConstantExpr *> &newValue ) { clobber = newValue; }
     122        void set_clobber( const std::list<ConstantExpr *> & newValue ) { clobber = newValue; }
    119123        std::list<Label> & get_gotolabels() { return gotolabels; }
    120         void set_gotolabels( const std::list<Label> &newValue ) { gotolabels = newValue; }
    121 
    122         virtual AsmStmt * clone() const { return new AsmStmt( *this ); }
    123         virtual void accept( Visitor & v ) { v.visit( this ); }
    124         virtual Statement * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    125         virtual void print( std::ostream & os, Indenter indent = {} ) const;
     124        void set_gotolabels( const std::list<Label> & newValue ) { gotolabels = newValue; }
     125
     126        virtual AsmStmt * clone() const override { return new AsmStmt( *this ); }
     127        virtual void accept( Visitor & v ) override { v.visit( this ); }
     128        virtual void accept( Visitor & v ) const override { v.visit( this ); }
     129        virtual Statement * acceptMutator( Mutator & m ) override { return m.mutate( this ); }
     130        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    126131};
    127132
     
    133138        virtual ~DirectiveStmt(){}
    134139
    135         virtual DirectiveStmt * clone() const { return new DirectiveStmt( *this ); }
    136         virtual void accept( Visitor & v ) { v.visit( this ); }
    137         virtual Statement * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    138         virtual void print( std::ostream & os, Indenter indent = {} ) const;
     140        virtual DirectiveStmt * clone() const override { return new DirectiveStmt( *this ); }
     141        virtual void accept( Visitor & v ) override { v.visit( this ); }
     142        virtual void accept( Visitor & v ) const override { v.visit( this ); }
     143        virtual Statement * acceptMutator( Mutator & m ) override { return m.mutate( this ); }
     144        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    139145};
    140146
    141147class IfStmt : public Statement {
    142148  public:
    143         Expression *condition;
    144         Statement *thenPart;
    145         Statement *elsePart;
     149        Expression * condition;
     150        Statement * thenPart;
     151        Statement * elsePart;
    146152        std::list<Statement *> initialization;
    147153
    148         IfStmt( Expression *condition, Statement *thenPart, Statement *elsePart,
     154        IfStmt( Expression * condition, Statement * thenPart, Statement * elsePart,
    149155                        std::list<Statement *> initialization = std::list<Statement *>() );
    150         IfStmt( const IfStmt &other );
     156        IfStmt( const IfStmt & other );
    151157        virtual ~IfStmt();
    152158
    153         std::list<Statement *> &get_initialization() { return initialization; }
    154         Expression *get_condition() { return condition; }
    155         void set_condition( Expression *newValue ) { condition = newValue; }
    156         Statement *get_thenPart() { return thenPart; }
    157         void set_thenPart( Statement *newValue ) { thenPart = newValue; }
    158         Statement *get_elsePart() { return elsePart; }
    159         void set_elsePart( Statement *newValue ) { elsePart = newValue; }
    160 
    161         virtual IfStmt *clone() const override { return new IfStmt( *this ); }
    162         virtual void accept( Visitor &v ) override { v.visit( this ); }
    163         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    164         virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     159        std::list<Statement *> & get_initialization() { return initialization; }
     160        Expression * get_condition() { return condition; }
     161        void set_condition( Expression * newValue ) { condition = newValue; }
     162        Statement * get_thenPart() { return thenPart; }
     163        void set_thenPart( Statement * newValue ) { thenPart = newValue; }
     164        Statement * get_elsePart() { return elsePart; }
     165        void set_elsePart( Statement * newValue ) { elsePart = newValue; }
     166
     167        virtual IfStmt * clone() const override { return new IfStmt( *this ); }
     168        virtual void accept( Visitor & v ) override { v.visit( this ); }
     169        virtual void accept( Visitor & v ) const override { v.visit( this ); }
     170        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
     171        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    165172};
    166173
     
    170177        std::list<Statement *> statements;
    171178
    172         SwitchStmt( Expression *condition, const std::list<Statement *> &statements );
    173         SwitchStmt( const SwitchStmt &other );
     179        SwitchStmt( Expression * condition, const std::list<Statement *> & statements );
     180        SwitchStmt( const SwitchStmt & other );
    174181        virtual ~SwitchStmt();
    175182
    176         Expression *get_condition() { return condition; }
    177         void set_condition( Expression *newValue ) { condition = newValue; }
     183        Expression * get_condition() { return condition; }
     184        void set_condition( Expression * newValue ) { condition = newValue; }
    178185
    179186        std::list<Statement *> & get_statements() { return statements; }
    180187
    181         virtual void accept( Visitor &v ) override { v.visit( this ); }
    182         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    183 
    184         virtual SwitchStmt *clone() const override { return new SwitchStmt( *this ); }
    185         virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     188        virtual void accept( Visitor & v ) override { v.visit( this ); }
     189        virtual void accept( Visitor & v ) const override { v.visit( this ); }
     190        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
     191
     192        virtual SwitchStmt * clone() const override { return new SwitchStmt( *this ); }
     193        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    186194
    187195};
     
    192200        std::list<Statement *> stmts;
    193201
    194         CaseStmt( Expression *conditions, const std::list<Statement *> &stmts, bool isdef = false ) throw (SemanticErrorException);
    195         CaseStmt( const CaseStmt &other );
     202        CaseStmt( Expression * conditions, const std::list<Statement *> & stmts, bool isdef = false ) throw (SemanticErrorException);
     203        CaseStmt( const CaseStmt & other );
    196204        virtual ~CaseStmt();
    197205
     
    201209        void set_default(bool b) { _isDefault = b; }
    202210
    203         Expression * &get_condition() { return condition; }
    204         void set_condition( Expression *newValue ) { condition = newValue; }
    205 
    206         std::list<Statement *> &get_statements() { return stmts; }
    207         void set_statements( std::list<Statement *> &newValue ) { stmts = newValue; }
    208 
    209         virtual void accept( Visitor &v ) override { v.visit( this ); }
    210         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    211 
    212         virtual CaseStmt *clone() const override { return new CaseStmt( *this ); }
    213         virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     211        Expression * & get_condition() { return condition; }
     212        void set_condition( Expression * newValue ) { condition = newValue; }
     213
     214        std::list<Statement *> & get_statements() { return stmts; }
     215        void set_statements( std::list<Statement *> & newValue ) { stmts = newValue; }
     216
     217        virtual void accept( Visitor & v ) override { v.visit( this ); }
     218        virtual void accept( Visitor & v ) const override { v.visit( this ); }
     219        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
     220
     221        virtual CaseStmt * clone() const override { return new CaseStmt( *this ); }
     222        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    214223  private:
    215224        bool _isDefault;
     
    218227class WhileStmt : public Statement {
    219228  public:
    220         Expression *condition;
    221         Statement *body;
     229        Expression * condition;
     230        Statement * body;
    222231        std::list<Statement *> initialization;
    223232        bool isDoWhile;
    224233
    225         WhileStmt( Expression *condition,
    226                Statement *body, std::list<Statement *> & initialization, bool isDoWhile = false );
    227         WhileStmt( const WhileStmt &other );
     234        WhileStmt( Expression * condition, Statement * body, std::list<Statement *> & initialization, bool isDoWhile = false );
     235        WhileStmt( const WhileStmt & other );
    228236        virtual ~WhileStmt();
    229237
    230         Expression *get_condition() { return condition; }
    231         void set_condition( Expression *newValue ) { condition = newValue; }
    232         Statement *get_body() { return body; }
    233         void set_body( Statement *newValue ) { body = newValue; }
     238        Expression * get_condition() { return condition; }
     239        void set_condition( Expression * newValue ) { condition = newValue; }
     240        Statement * get_body() { return body; }
     241        void set_body( Statement * newValue ) { body = newValue; }
    234242        bool get_isDoWhile() { return isDoWhile; }
    235243        void set_isDoWhile( bool newValue ) { isDoWhile = newValue; }
    236244
    237         virtual WhileStmt *clone() const override { return new WhileStmt( *this ); }
    238         virtual void accept( Visitor &v ) override { v.visit( this ); }
    239         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    240         virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     245        virtual WhileStmt * clone() const override { return new WhileStmt( *this ); }
     246        virtual void accept( Visitor & v ) override { v.visit( this ); }
     247        virtual void accept( Visitor & v ) const override { v.visit( this ); }
     248        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
     249        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    241250};
    242251
     
    244253  public:
    245254        std::list<Statement *> initialization;
    246         Expression *condition;
    247         Expression *increment;
    248         Statement *body;
    249 
    250         ForStmt( std::list<Statement *> initialization,
    251              Expression *condition = 0, Expression *increment = 0, Statement *body = 0 );
    252         ForStmt( const ForStmt &other );
     255        Expression * condition;
     256        Expression * increment;
     257        Statement * body;
     258
     259        ForStmt( std::list<Statement *> initialization, Expression * condition = 0, Expression * increment = 0, Statement * body = 0 );
     260        ForStmt( const ForStmt & other );
    253261        virtual ~ForStmt();
    254262
    255         std::list<Statement *> &get_initialization() { return initialization; }
    256         Expression *get_condition() { return condition; }
    257         void set_condition( Expression *newValue ) { condition = newValue; }
    258         Expression *get_increment() { return increment; }
    259         void set_increment( Expression *newValue ) { increment = newValue; }
    260         Statement *get_body() { return body; }
    261         void set_body( Statement *newValue ) { body = newValue; }
    262 
    263         virtual ForStmt *clone() const override { return new ForStmt( *this ); }
    264         virtual void accept( Visitor &v ) override { v.visit( this ); }
    265         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    266         virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     263        std::list<Statement *> & get_initialization() { return initialization; }
     264        Expression * get_condition() { return condition; }
     265        void set_condition( Expression * newValue ) { condition = newValue; }
     266        Expression * get_increment() { return increment; }
     267        void set_increment( Expression * newValue ) { increment = newValue; }
     268        Statement * get_body() { return body; }
     269        void set_body( Statement * newValue ) { body = newValue; }
     270
     271        virtual ForStmt * clone() const override { return new ForStmt( *this ); }
     272        virtual void accept( Visitor & v ) override { v.visit( this ); }
     273        virtual void accept( Visitor & v ) const override { v.visit( this ); }
     274        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
     275        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    267276};
    268277
     
    274283        const Label originalTarget;
    275284        Label target;
    276         Expression *computedTarget;
     285        Expression * computedTarget;
    277286        Type type;
    278287
    279288        BranchStmt( Label target, Type ) throw (SemanticErrorException);
    280         BranchStmt( Expression *computedTarget, Type ) throw (SemanticErrorException);
     289        BranchStmt( Expression * computedTarget, Type ) throw (SemanticErrorException);
    281290
    282291        Label get_originalTarget() { return originalTarget; }
     
    284293        void set_target( Label newValue ) { target = newValue; }
    285294
    286         Expression *get_computedTarget() { return computedTarget; }
     295        Expression * get_computedTarget() { return computedTarget; }
    287296        void set_target( Expression * newValue ) { computedTarget = newValue; }
    288297
    289298        Type get_type() { return type; }
    290         const char *get_typename() { return brType[ type ]; }
    291 
    292         virtual BranchStmt *clone() const override { return new BranchStmt( *this ); }
    293         virtual void accept( Visitor &v ) override { v.visit( this ); }
    294         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    295         virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     299        const char * get_typename() { return brType[ type ]; }
     300
     301        virtual BranchStmt * clone() const override { return new BranchStmt( *this ); }
     302        virtual void accept( Visitor & v ) override { v.visit( this ); }
     303        virtual void accept( Visitor & v ) const override { v.visit( this ); }
     304        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
     305        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    296306  private:
    297         static const char *brType[];
     307        static const char * brType[];
    298308};
    299309
    300310class ReturnStmt : public Statement {
    301311  public:
    302         Expression *expr;
    303 
    304         ReturnStmt( Expression *expr );
    305         ReturnStmt( const ReturnStmt &other );
     312        Expression * expr;
     313
     314        ReturnStmt( Expression * expr );
     315        ReturnStmt( const ReturnStmt & other );
    306316        virtual ~ReturnStmt();
    307317
    308         Expression *get_expr() { return expr; }
    309         void set_expr( Expression *newValue ) { expr = newValue; }
    310 
    311         virtual ReturnStmt *clone() const override { return new ReturnStmt( *this ); }
    312         virtual void accept( Visitor &v ) override { v.visit( this ); }
    313         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    314         virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     318        Expression * get_expr() { return expr; }
     319        void set_expr( Expression * newValue ) { expr = newValue; }
     320
     321        virtual ReturnStmt * clone() const override { return new ReturnStmt( *this ); }
     322        virtual void accept( Visitor & v ) override { v.visit( this ); }
     323        virtual void accept( Visitor & v ) const override { v.visit( this ); }
     324        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
     325        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    315326};
    316327
     
    324335
    325336        ThrowStmt( Kind kind, Expression * expr, Expression * target = nullptr );
    326         ThrowStmt( const ThrowStmt &other );
     337        ThrowStmt( const ThrowStmt & other );
    327338        virtual ~ThrowStmt();
    328339
     
    333344        void set_target( Expression * newTarget ) { target = newTarget; }
    334345
    335         virtual ThrowStmt *clone() const override { return new ThrowStmt( *this ); }
    336         virtual void accept( Visitor &v ) override { v.visit( this ); }
    337         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    338         virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     346        virtual ThrowStmt * clone() const override { return new ThrowStmt( *this ); }
     347        virtual void accept( Visitor & v ) override { v.visit( this ); }
     348        virtual void accept( Visitor & v ) const override { v.visit( this ); }
     349        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
     350        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    339351};
    340352
     
    345357        FinallyStmt * finallyBlock;
    346358
    347         TryStmt( CompoundStmt *tryBlock, std::list<CatchStmt *> &handlers, FinallyStmt *finallyBlock = 0 );
    348         TryStmt( const TryStmt &other );
     359        TryStmt( CompoundStmt * tryBlock, std::list<CatchStmt *> & handlers, FinallyStmt * finallyBlock = 0 );
     360        TryStmt( const TryStmt & other );
    349361        virtual ~TryStmt();
    350362
    351         CompoundStmt *get_block() const { return block; }
    352         void set_block( CompoundStmt *newValue ) { block = newValue; }
     363        CompoundStmt * get_block() const { return block; }
     364        void set_block( CompoundStmt * newValue ) { block = newValue; }
    353365        std::list<CatchStmt *>& get_catchers() { return handlers; }
    354366
    355         FinallyStmt *get_finally() const { return finallyBlock; }
    356         void set_finally( FinallyStmt *newValue ) { finallyBlock = newValue; }
    357 
    358         virtual TryStmt *clone() const override { return new TryStmt( *this ); }
    359         virtual void accept( Visitor &v ) override { v.visit( this ); }
    360         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    361         virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     367        FinallyStmt * get_finally() const { return finallyBlock; }
     368        void set_finally( FinallyStmt * newValue ) { finallyBlock = newValue; }
     369
     370        virtual TryStmt * clone() const override { return new TryStmt( *this ); }
     371        virtual void accept( Visitor & v ) override { v.visit( this ); }
     372        virtual void accept( Visitor & v ) const override { v.visit( this ); }
     373        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
     374        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    362375};
    363376
     
    367380
    368381        const Kind kind;
    369         Declaration *decl;
    370         Expression *cond;
    371         Statement *body;
    372 
    373         CatchStmt( Kind kind, Declaration *decl,
    374                    Expression *cond, Statement *body );
    375         CatchStmt( const CatchStmt &other );
     382        Declaration * decl;
     383        Expression * cond;
     384        Statement * body;
     385
     386        CatchStmt( Kind kind, Declaration * decl,
     387                   Expression * cond, Statement * body );
     388        CatchStmt( const CatchStmt & other );
    376389        virtual ~CatchStmt();
    377390
    378391        Kind get_kind() { return kind; }
    379         Declaration *get_decl() { return decl; }
    380         void set_decl( Declaration *newValue ) { decl = newValue; }
    381         Expression *get_cond() { return cond; }
    382         void set_cond( Expression *newCond ) { cond = newCond; }
    383         Statement *get_body() { return body; }
    384         void set_body( Statement *newValue ) { body = newValue; }
    385 
    386         virtual CatchStmt *clone() const override { return new CatchStmt( *this ); }
    387         virtual void accept( Visitor &v ) override { v.visit( this ); }
    388         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    389         virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     392        Declaration * get_decl() { return decl; }
     393        void set_decl( Declaration * newValue ) { decl = newValue; }
     394        Expression * get_cond() { return cond; }
     395        void set_cond( Expression * newCond ) { cond = newCond; }
     396        Statement * get_body() { return body; }
     397        void set_body( Statement * newValue ) { body = newValue; }
     398
     399        virtual CatchStmt * clone() const override { return new CatchStmt( *this ); }
     400        virtual void accept( Visitor & v ) override { v.visit( this ); }
     401        virtual void accept( Visitor & v ) const override { v.visit( this ); }
     402        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
     403        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    390404};
    391405
    392406class FinallyStmt : public Statement {
    393407  public:
    394         CompoundStmt *block;
    395 
    396         FinallyStmt( CompoundStmt *block );
    397         FinallyStmt( const FinallyStmt &other );
     408        CompoundStmt * block;
     409
     410        FinallyStmt( CompoundStmt * block );
     411        FinallyStmt( const FinallyStmt & other );
    398412        virtual ~FinallyStmt();
    399413
    400         CompoundStmt *get_block() const { return block; }
    401         void set_block( CompoundStmt *newValue ) { block = newValue; }
    402 
    403         virtual FinallyStmt *clone() const override { return new FinallyStmt( *this ); }
    404         virtual void accept( Visitor &v ) override { v.visit( this ); }
    405         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    406         virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     414        CompoundStmt * get_block() const { return block; }
     415        void set_block( CompoundStmt * newValue ) { block = newValue; }
     416
     417        virtual FinallyStmt * clone() const override { return new FinallyStmt( *this ); }
     418        virtual void accept( Visitor & v ) override { v.visit( this ); }
     419        virtual void accept( Visitor & v ) const override { v.visit( this ); }
     420        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
     421        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    407422};
    408423
     
    438453        } orelse;
    439454
    440         virtual WaitForStmt *clone() const override { return new WaitForStmt( *this ); }
    441         virtual void accept( Visitor &v ) override { v.visit( this ); }
    442         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    443         virtual void print( std::ostream &os, Indenter indent = {} ) const override;
    444 
    445 };
    446 
    447 class WithStmt : public Statement {
    448 public:
    449         std::list< Expression * > exprs;
    450         Statement * stmt;
    451 
    452         WithStmt( const std::list< Expression * > & exprs, Statement * stmt );
    453         WithStmt( const WithStmt & other );
    454         virtual ~WithStmt();
    455 
    456         virtual WithStmt * clone() const override { return new WithStmt( *this ); }
    457         virtual void accept( Visitor & v ) override { v.visit( this ); }
    458         virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
    459         virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    460 };
     455        virtual WaitForStmt * clone() const override { return new WaitForStmt( *this ); }
     456        virtual void accept( Visitor & v ) override { v.visit( this ); }
     457        virtual void accept( Visitor & v ) const override { v.visit( this ); }
     458        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
     459        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
     460
     461};
     462
     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// };
    461478
    462479
     
    464481class DeclStmt : public Statement {
    465482  public:
    466         Declaration *decl;
    467 
    468         DeclStmt( Declaration *decl );
    469         DeclStmt( const DeclStmt &other );
     483        Declaration * decl;
     484
     485        DeclStmt( Declaration * decl );
     486        DeclStmt( const DeclStmt & other );
    470487        virtual ~DeclStmt();
    471488
    472         Declaration *get_decl() const { return decl; }
    473         void set_decl( Declaration *newValue ) { decl = newValue; }
    474 
    475         virtual DeclStmt *clone() const override { return new DeclStmt( *this ); }
    476         virtual void accept( Visitor &v ) override { v.visit( this ); }
    477         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    478         virtual void print( std::ostream &os, Indenter indent = {} ) const override;
    479 };
    480 
    481 
    482 /// represents an implicit application of a constructor or destructor. Qualifiers are replaced
    483 /// immediately before and after the call so that qualified objects can be constructed
    484 /// with the same functions as unqualified objects.
     489        Declaration * get_decl() const { return decl; }
     490        void set_decl( Declaration * newValue ) { decl = newValue; }
     491
     492        virtual DeclStmt * clone() const override { return new DeclStmt( *this ); }
     493        virtual void accept( Visitor & v ) override { v.visit( this ); }
     494        virtual void accept( Visitor & v ) const override { v.visit( this ); }
     495        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
     496        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
     497};
     498
     499
     500/// represents an implicit application of a constructor or destructor. Qualifiers are replaced immediately before and
     501/// after the call so that qualified objects can be constructed with the same functions as unqualified objects.
    485502class ImplicitCtorDtorStmt : public Statement {
    486503  public:
     
    492509        virtual ~ImplicitCtorDtorStmt();
    493510
    494         Statement *get_callStmt() const { return callStmt; }
     511        Statement * get_callStmt() const { return callStmt; }
    495512        void set_callStmt( Statement * newValue ) { callStmt = newValue; }
    496513
    497         virtual ImplicitCtorDtorStmt *clone() const override { return new ImplicitCtorDtorStmt( *this ); }
    498         virtual void accept( Visitor &v ) override { v.visit( this ); }
    499         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    500         virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     514        virtual ImplicitCtorDtorStmt * clone() const override { return new ImplicitCtorDtorStmt( *this ); }
     515        virtual void accept( Visitor & v ) override { v.visit( this ); }
     516        virtual void accept( Visitor & v ) const override { v.visit( this ); }
     517        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
     518        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    501519};
    502520
Note: See TracChangeset for help on using the changeset viewer.