Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Statement.h

    re67991f ree3c93d  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar 12 09:01:53 2019
    13 // Update Count     : 83
     12// Last Modified On : Thu Mar  8 14:53:02 2018
     13// Update Count     : 78
    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 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;
     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;
    5049};
    5150
     
    5655        CompoundStmt();
    5756        CompoundStmt( std::list<Statement *> stmts );
    58         CompoundStmt( const CompoundStmt & other );
     57        CompoundStmt( const CompoundStmt &other );
    5958        virtual ~CompoundStmt();
    6059
     
    6362        void push_front( Statement * stmt ) { kids.push_front( stmt ); }
    6463
    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;
     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;
    7068};
    7169
     
    7472        NullStmt( const std::list<Label> & labels = {} );
    7573
    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;
     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;
    8178};
    8279
    8380class ExprStmt : public Statement {
    8481  public:
    85         Expression * expr;
    86 
    87         ExprStmt( Expression * expr );
    88         ExprStmt( const ExprStmt & other );
     82        Expression *expr;
     83
     84        ExprStmt( Expression *expr );
     85        ExprStmt( const ExprStmt &other );
    8986        virtual ~ExprStmt();
    9087
    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;
     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;
    9995};
    10096
     
    10298  public:
    10399        bool voltile;
    104         Expression * instruction;
     100        Expression *instruction;
    105101        std::list<Expression *> output, input;
    106102        std::list<ConstantExpr *> clobber;
    107103        std::list<Label> gotolabels;
    108104
    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 );
     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 );
    111107        virtual ~AsmStmt();
    112108
     
    118114        void set_output( const std::list<Expression *> & newValue ) { output = newValue; }
    119115        std::list<Expression *> & get_input() { return input; }
    120         void set_input( const std::list<Expression *> & newValue ) { input = newValue; }
     116        void set_input( const std::list<Expression *> &newValue ) { input = newValue; }
    121117        std::list<ConstantExpr *> & get_clobber() { return clobber; }
    122         void set_clobber( const std::list<ConstantExpr *> & newValue ) { clobber = newValue; }
     118        void set_clobber( const std::list<ConstantExpr *> &newValue ) { clobber = newValue; }
    123119        std::list<Label> & get_gotolabels() { return gotolabels; }
    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;
     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;
    131126};
    132127
     
    138133        virtual ~DirectiveStmt(){}
    139134
    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;
     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;
    145139};
    146140
    147141class IfStmt : public Statement {
    148142  public:
    149         Expression * condition;
    150         Statement * thenPart;
    151         Statement * elsePart;
     143        Expression *condition;
     144        Statement *thenPart;
     145        Statement *elsePart;
    152146        std::list<Statement *> initialization;
    153147
    154         IfStmt( Expression * condition, Statement * thenPart, Statement * elsePart,
     148        IfStmt( Expression *condition, Statement *thenPart, Statement *elsePart,
    155149                        std::list<Statement *> initialization = std::list<Statement *>() );
    156         IfStmt( const IfStmt & other );
     150        IfStmt( const IfStmt &other );
    157151        virtual ~IfStmt();
    158152
    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;
     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;
    172165};
    173166
     
    177170        std::list<Statement *> statements;
    178171
    179         SwitchStmt( Expression * condition, const std::list<Statement *> & statements );
    180         SwitchStmt( const SwitchStmt & other );
     172        SwitchStmt( Expression *condition, const std::list<Statement *> &statements );
     173        SwitchStmt( const SwitchStmt &other );
    181174        virtual ~SwitchStmt();
    182175
    183         Expression * get_condition() { return condition; }
    184         void set_condition( Expression * newValue ) { condition = newValue; }
     176        Expression *get_condition() { return condition; }
     177        void set_condition( Expression *newValue ) { condition = newValue; }
    185178
    186179        std::list<Statement *> & get_statements() { return statements; }
    187180
    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;
     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;
    194186
    195187};
     
    200192        std::list<Statement *> stmts;
    201193
    202         CaseStmt( Expression * conditions, const std::list<Statement *> & stmts, bool isdef = false ) throw (SemanticErrorException);
    203         CaseStmt( const CaseStmt & other );
     194        CaseStmt( Expression *conditions, const std::list<Statement *> &stmts, bool isdef = false ) throw (SemanticErrorException);
     195        CaseStmt( const CaseStmt &other );
    204196        virtual ~CaseStmt();
    205197
     
    209201        void set_default(bool b) { _isDefault = b; }
    210202
    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;
     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;
    223214  private:
    224215        bool _isDefault;
     
    227218class WhileStmt : public Statement {
    228219  public:
    229         Expression * condition;
    230         Statement * body;
     220        Expression *condition;
     221        Statement *body;
    231222        std::list<Statement *> initialization;
    232223        bool isDoWhile;
    233224
    234         WhileStmt( Expression * condition, Statement * body, std::list<Statement *> & initialization, bool isDoWhile = false );
    235         WhileStmt( const WhileStmt & other );
     225        WhileStmt( Expression *condition,
     226               Statement *body, std::list<Statement *> & initialization, bool isDoWhile = false );
     227        WhileStmt( const WhileStmt &other );
    236228        virtual ~WhileStmt();
    237229
    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; }
     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; }
    242234        bool get_isDoWhile() { return isDoWhile; }
    243235        void set_isDoWhile( bool newValue ) { isDoWhile = newValue; }
    244236
    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;
     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;
    250241};
    251242
     
    253244  public:
    254245        std::list<Statement *> initialization;
    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 );
     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 );
    261253        virtual ~ForStmt();
    262254
    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;
     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;
    276267};
    277268
     
    283274        const Label originalTarget;
    284275        Label target;
    285         Expression * computedTarget;
     276        Expression *computedTarget;
    286277        Type type;
    287278
    288279        BranchStmt( Label target, Type ) throw (SemanticErrorException);
    289         BranchStmt( Expression * computedTarget, Type ) throw (SemanticErrorException);
     280        BranchStmt( Expression *computedTarget, Type ) throw (SemanticErrorException);
    290281
    291282        Label get_originalTarget() { return originalTarget; }
     
    293284        void set_target( Label newValue ) { target = newValue; }
    294285
    295         Expression * get_computedTarget() { return computedTarget; }
     286        Expression *get_computedTarget() { return computedTarget; }
    296287        void set_target( Expression * newValue ) { computedTarget = newValue; }
    297288
    298289        Type get_type() { return type; }
    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;
     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;
    306296  private:
    307         static const char * brType[];
     297        static const char *brType[];
    308298};
    309299
    310300class ReturnStmt : public Statement {
    311301  public:
    312         Expression * expr;
    313 
    314         ReturnStmt( Expression * expr );
    315         ReturnStmt( const ReturnStmt & other );
     302        Expression *expr;
     303
     304        ReturnStmt( Expression *expr );
     305        ReturnStmt( const ReturnStmt &other );
    316306        virtual ~ReturnStmt();
    317307
    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;
     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;
    326315};
    327316
     
    335324
    336325        ThrowStmt( Kind kind, Expression * expr, Expression * target = nullptr );
    337         ThrowStmt( const ThrowStmt & other );
     326        ThrowStmt( const ThrowStmt &other );
    338327        virtual ~ThrowStmt();
    339328
     
    344333        void set_target( Expression * newTarget ) { target = newTarget; }
    345334
    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;
     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;
    351339};
    352340
     
    357345        FinallyStmt * finallyBlock;
    358346
    359         TryStmt( CompoundStmt * tryBlock, std::list<CatchStmt *> & handlers, FinallyStmt * finallyBlock = 0 );
    360         TryStmt( const TryStmt & other );
     347        TryStmt( CompoundStmt *tryBlock, std::list<CatchStmt *> &handlers, FinallyStmt *finallyBlock = 0 );
     348        TryStmt( const TryStmt &other );
    361349        virtual ~TryStmt();
    362350
    363         CompoundStmt * get_block() const { return block; }
    364         void set_block( CompoundStmt * newValue ) { block = newValue; }
     351        CompoundStmt *get_block() const { return block; }
     352        void set_block( CompoundStmt *newValue ) { block = newValue; }
    365353        std::list<CatchStmt *>& get_catchers() { return handlers; }
    366354
    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;
     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;
    375362};
    376363
     
    380367
    381368        const Kind kind;
    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 );
     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 );
    389376        virtual ~CatchStmt();
    390377
    391378        Kind get_kind() { return kind; }
    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;
     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;
    404390};
    405391
    406392class FinallyStmt : public Statement {
    407393  public:
    408         CompoundStmt * block;
    409 
    410         FinallyStmt( CompoundStmt * block );
    411         FinallyStmt( const FinallyStmt & other );
     394        CompoundStmt *block;
     395
     396        FinallyStmt( CompoundStmt *block );
     397        FinallyStmt( const FinallyStmt &other );
    412398        virtual ~FinallyStmt();
    413399
    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;
     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;
    422407};
    423408
     
    453438        } orelse;
    454439
    455         virtual WaitForStmt * clone() const override { return new WaitForStmt( *this ); }
     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
     447class WithStmt : public Statement {
     448public:
     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 ); }
    456457        virtual void accept( Visitor & v ) override { v.visit( this ); }
    457         virtual void accept( Visitor & v ) const override { v.visit( this ); }
    458458        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
    459459        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 // };
     460};
    478461
    479462
     
    481464class DeclStmt : public Statement {
    482465  public:
    483         Declaration * decl;
    484 
    485         DeclStmt( Declaration * decl );
    486         DeclStmt( const DeclStmt & other );
     466        Declaration *decl;
     467
     468        DeclStmt( Declaration *decl );
     469        DeclStmt( const DeclStmt &other );
    487470        virtual ~DeclStmt();
    488471
    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.
     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.
    502485class ImplicitCtorDtorStmt : public Statement {
    503486  public:
     
    509492        virtual ~ImplicitCtorDtorStmt();
    510493
    511         Statement * get_callStmt() const { return callStmt; }
     494        Statement *get_callStmt() const { return callStmt; }
    512495        void set_callStmt( Statement * newValue ) { callStmt = newValue; }
    513496
    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;
     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;
    519501};
    520502
Note: See TracChangeset for help on using the changeset viewer.