Changes in src/SynTree/Statement.h [70d826cd:50377a4]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Statement.h
r70d826cd r50377a4 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Aug 17 15:37:53201713 // Update Count : 7 212 // Last Modified On : Sun Sep 3 20:46:46 2017 13 // Update Count : 77 14 14 // 15 15 … … 43 43 const std::list<Label> & get_labels() const { return labels; } 44 44 45 virtual Statement *clone() const = 0;46 virtual void accept( Visitor &v ) = 0;47 virtual Statement *acceptMutator( Mutator &m ) = 0;48 virtual void print( std::ostream &os, int indent = 0 ) const;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; 49 49 }; 50 50 … … 54 54 55 55 CompoundStmt( std::list<Label> labels ); 56 CompoundStmt( std::list<Statement *> stmts ); 56 57 CompoundStmt( const CompoundStmt &other ); 57 58 virtual ~CompoundStmt(); … … 61 62 void push_front( Statement * stmt ) { kids.push_front( stmt ); } 62 63 63 virtual CompoundStmt *clone() const { return new CompoundStmt( *this ); }64 virtual void accept( Visitor &v ) { v.visit( this ); }65 virtual CompoundStmt *acceptMutator( Mutator &m ) { return m.mutate( this ); }66 virtual void print( std::ostream &os, int indent = 0 ) const;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; 67 68 }; 68 69 … … 72 73 NullStmt( std::list<Label> labels ); 73 74 74 virtual NullStmt *clone() const { return new NullStmt( *this ); }75 virtual void accept( Visitor &v ) { v.visit( this ); }76 virtual NullStmt *acceptMutator( Mutator &m ) { return m.mutate( this ); }77 virtual void print( std::ostream &os, int indent = 0 ) const;75 virtual NullStmt *clone() const override { return new NullStmt( *this ); } 76 virtual void accept( Visitor &v ) override { v.visit( this ); } 77 virtual NullStmt *acceptMutator( Mutator &m ) override { return m.mutate( this ); } 78 virtual void print( std::ostream &os, Indenter indent = {} ) const override; 78 79 }; 79 80 … … 89 90 void set_expr( Expression *newValue ) { expr = newValue; } 90 91 91 virtual ExprStmt *clone() const { return new ExprStmt( *this ); }92 virtual void accept( Visitor &v ) { v.visit( this ); }93 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }94 virtual void print( std::ostream &os, int indent = 0 ) const;92 virtual ExprStmt *clone() const override { return new ExprStmt( *this ); } 93 virtual void accept( Visitor &v ) override { v.visit( this ); } 94 virtual Statement *acceptMutator( Mutator &m ) override { return m.mutate( this ); } 95 virtual void print( std::ostream &os, Indenter indent = {} ) const override; 95 96 }; 96 97 … … 98 99 public: 99 100 bool voltile; 100 ConstantExpr*instruction;101 Expression *instruction; 101 102 std::list<Expression *> output, input; 102 103 std::list<ConstantExpr *> clobber; 103 104 std::list<Label> gotolabels; 104 105 105 AsmStmt( std::list<Label> labels, bool voltile, ConstantExpr *instruction, std::list<Expression *> input, std::list<Expression *> output, 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 ); 106 107 AsmStmt( const AsmStmt &other ); 107 108 virtual ~AsmStmt(); … … 109 110 bool get_voltile() { return voltile; } 110 111 void set_voltile( bool newValue ) { voltile = newValue; } 111 ConstantExpr *get_instruction() { return instruction; }112 void set_instruction( ConstantExpr *newValue ) { instruction = newValue; }113 std::list<Expression *> & get_output() { return output; }114 void set_output( const std::list<Expression *> & newValue ) { output = newValue; }115 std::list<Expression *> & get_input() { return input; }112 Expression * get_instruction() { return instruction; } 113 void set_instruction( Expression * newValue ) { instruction = newValue; } 114 std::list<Expression *> & get_output() { return output; } 115 void set_output( const std::list<Expression *> & newValue ) { output = newValue; } 116 std::list<Expression *> & get_input() { return input; } 116 117 void set_input( const std::list<Expression *> &newValue ) { input = newValue; } 117 std::list<ConstantExpr *> & get_clobber() { return clobber; }118 std::list<ConstantExpr *> & get_clobber() { return clobber; } 118 119 void set_clobber( const std::list<ConstantExpr *> &newValue ) { clobber = newValue; } 119 std::list<Label> & get_gotolabels() { return gotolabels; }120 std::list<Label> & get_gotolabels() { return gotolabels; } 120 121 void set_gotolabels( const std::list<Label> &newValue ) { gotolabels = newValue; } 121 122 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, int indent = 0) const;123 virtual AsmStmt * clone() const { return new AsmStmt( *this ); } 124 virtual void accept( Visitor & v ) { v.visit( this ); } 125 virtual Statement * acceptMutator( Mutator & m ) { return m.mutate( this ); } 126 virtual void print( std::ostream & os, Indenter indent = {} ) const; 126 127 }; 127 128 … … 146 147 void set_elsePart( Statement *newValue ) { elsePart = newValue; } 147 148 148 virtual IfStmt *clone() const { return new IfStmt( *this ); }149 virtual void accept( Visitor &v ) { v.visit( this ); }150 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }151 virtual void print( std::ostream &os, int indent = 0 ) const;149 virtual IfStmt *clone() const override { return new IfStmt( *this ); } 150 virtual void accept( Visitor &v ) override { v.visit( this ); } 151 virtual Statement *acceptMutator( Mutator &m ) override { return m.mutate( this ); } 152 virtual void print( std::ostream &os, Indenter indent = {} ) const override; 152 153 }; 153 154 … … 155 156 public: 156 157 Expression * condition; 157 158 SwitchStmt( std::list<Label> labels, Expression *condition, std::list<Statement *> &statements ); 158 std::list<Statement *> statements; 159 160 SwitchStmt( std::list<Label> labels, Expression *condition, const std::list<Statement *> &statements ); 159 161 SwitchStmt( const SwitchStmt &other ); 160 162 virtual ~SwitchStmt(); … … 165 167 std::list<Statement *> & get_statements() { return statements; } 166 168 167 virtual void accept( Visitor &v ) { v.visit( this ); } 168 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); } 169 170 virtual SwitchStmt *clone() const { return new SwitchStmt( *this ); } 171 virtual void print( std::ostream &os, int indent = 0 ) const; 172 private: 173 std::list<Statement *> statements; 169 virtual void accept( Visitor &v ) override { v.visit( this ); } 170 virtual Statement *acceptMutator( Mutator &m ) override { return m.mutate( this ); } 171 172 virtual SwitchStmt *clone() const override { return new SwitchStmt( *this ); } 173 virtual void print( std::ostream &os, Indenter indent = {} ) const override; 174 174 175 }; 175 176 … … 179 180 std::list<Statement *> stmts; 180 181 181 CaseStmt( std::list<Label> labels, Expression *conditions, 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); 182 183 CaseStmt( const CaseStmt &other ); 183 184 virtual ~CaseStmt(); … … 194 195 void set_statements( std::list<Statement *> &newValue ) { stmts = newValue; } 195 196 196 virtual void accept( Visitor &v ) { v.visit( this ); }197 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }198 199 virtual CaseStmt *clone() const { return new CaseStmt( *this ); }200 virtual void print( std::ostream &os, int indent = 0 ) const;197 virtual void accept( Visitor &v ) override { v.visit( this ); } 198 virtual Statement *acceptMutator( Mutator &m ) override { return m.mutate( this ); } 199 200 virtual CaseStmt *clone() const override { return new CaseStmt( *this ); } 201 virtual void print( std::ostream &os, Indenter indent = {} ) const override; 201 202 private: 202 203 bool _isDefault; … … 221 222 void set_isDoWhile( bool newValue ) { isDoWhile = newValue; } 222 223 223 virtual WhileStmt *clone() const { return new WhileStmt( *this ); }224 virtual void accept( Visitor &v ) { v.visit( this ); }225 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }226 virtual void print( std::ostream &os, int indent = 0 ) const;224 virtual WhileStmt *clone() const override { return new WhileStmt( *this ); } 225 virtual void accept( Visitor &v ) override { v.visit( this ); } 226 virtual Statement *acceptMutator( Mutator &m ) override { return m.mutate( this ); } 227 virtual void print( std::ostream &os, Indenter indent = {} ) const override; 227 228 }; 228 229 … … 247 248 void set_body( Statement *newValue ) { body = newValue; } 248 249 249 virtual ForStmt *clone() const { return new ForStmt( *this ); }250 virtual void accept( Visitor &v ) { v.visit( this ); }251 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }252 virtual void print( std::ostream &os, int indent = 0 ) const;250 virtual ForStmt *clone() const override { return new ForStmt( *this ); } 251 virtual void accept( Visitor &v ) override { v.visit( this ); } 252 virtual Statement *acceptMutator( Mutator &m ) override { return m.mutate( this ); } 253 virtual void print( std::ostream &os, Indenter indent = {} ) const override; 253 254 }; 254 255 … … 276 277 const char *get_typename() { return brType[ type ]; } 277 278 278 virtual BranchStmt *clone() const { return new BranchStmt( *this ); }279 virtual void accept( Visitor &v ) { v.visit( this ); }280 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }281 virtual void print( std::ostream &os, int indent = 0 ) const;279 virtual BranchStmt *clone() const override { return new BranchStmt( *this ); } 280 virtual void accept( Visitor &v ) override { v.visit( this ); } 281 virtual Statement *acceptMutator( Mutator &m ) override { return m.mutate( this ); } 282 virtual void print( std::ostream &os, Indenter indent = {} ) const override; 282 283 private: 283 284 static const char *brType[]; … … 295 296 void set_expr( Expression *newValue ) { expr = newValue; } 296 297 297 virtual ReturnStmt *clone() const { return new ReturnStmt( *this ); }298 virtual void accept( Visitor &v ) { v.visit( this ); }299 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }300 virtual void print( std::ostream &os, int indent = 0 ) const;298 virtual ReturnStmt *clone() const override { return new ReturnStmt( *this ); } 299 virtual void accept( Visitor &v ) override { v.visit( this ); } 300 virtual Statement *acceptMutator( Mutator &m ) override { return m.mutate( this ); } 301 virtual void print( std::ostream &os, Indenter indent = {} ) const override; 301 302 }; 302 303 … … 319 320 void set_target( Expression * newTarget ) { target = newTarget; } 320 321 321 virtual ThrowStmt *clone() const { return new ThrowStmt( *this ); }322 virtual void accept( Visitor &v ) { v.visit( this ); }323 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }324 virtual void print( std::ostream &os, int indent = 0 ) const;322 virtual ThrowStmt *clone() const override { return new ThrowStmt( *this ); } 323 virtual void accept( Visitor &v ) 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; 325 326 }; 326 327 327 328 class TryStmt : public Statement { 328 329 public: 329 CompoundStmt * block;330 CompoundStmt * block; 330 331 std::list<CatchStmt *> handlers; 331 FinallyStmt * finallyBlock;332 FinallyStmt * finallyBlock; 332 333 333 334 TryStmt( std::list<Label> labels, CompoundStmt *tryBlock, std::list<CatchStmt *> &handlers, FinallyStmt *finallyBlock = 0 ); … … 342 343 void set_finally( FinallyStmt *newValue ) { finallyBlock = newValue; } 343 344 344 virtual TryStmt *clone() const { return new TryStmt( *this ); }345 virtual void accept( Visitor &v ) { v.visit( this ); }346 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }347 virtual void print( std::ostream &os, int indent = 0 ) const;345 virtual TryStmt *clone() const override { return new TryStmt( *this ); } 346 virtual void accept( Visitor &v ) override { v.visit( this ); } 347 virtual Statement *acceptMutator( Mutator &m ) override { return m.mutate( this ); } 348 virtual void print( std::ostream &os, Indenter indent = {} ) const override; 348 349 }; 349 350 … … 370 371 void set_body( Statement *newValue ) { body = newValue; } 371 372 372 virtual CatchStmt *clone() const { return new CatchStmt( *this ); }373 virtual void accept( Visitor &v ) { v.visit( this ); }374 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }375 virtual void print( std::ostream &os, int indent = 0 ) const;373 virtual CatchStmt *clone() const override { return new CatchStmt( *this ); } 374 virtual void accept( Visitor &v ) override { v.visit( this ); } 375 virtual Statement *acceptMutator( Mutator &m ) override { return m.mutate( this ); } 376 virtual void print( std::ostream &os, Indenter indent = {} ) const override; 376 377 }; 377 378 … … 387 388 void set_block( CompoundStmt *newValue ) { block = newValue; } 388 389 389 virtual FinallyStmt *clone() const { return new FinallyStmt( *this ); }390 virtual void accept( Visitor &v ) { v.visit( this ); }391 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }392 virtual void print( std::ostream &os, int indent = 0 ) const;390 virtual FinallyStmt *clone() const override { return new FinallyStmt( *this ); } 391 virtual void accept( Visitor &v ) override { v.visit( this ); } 392 virtual Statement *acceptMutator( Mutator &m ) override { return m.mutate( this ); } 393 virtual void print( std::ostream &os, Indenter indent = {} ) const override; 393 394 }; 394 395 … … 424 425 } orelse; 425 426 426 virtual WaitForStmt *clone() const { return new WaitForStmt( *this ); }427 virtual void accept( Visitor &v ) { v.visit( this ); }428 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }429 virtual void print( std::ostream &os, int indent = 0 ) const;427 virtual WaitForStmt *clone() const override { return new WaitForStmt( *this ); } 428 virtual void accept( Visitor &v ) override { v.visit( this ); } 429 virtual Statement *acceptMutator( Mutator &m ) override { return m.mutate( this ); } 430 virtual void print( std::ostream &os, Indenter indent = {} ) const override; 430 431 431 432 }; … … 444 445 void set_decl( Declaration *newValue ) { decl = newValue; } 445 446 446 virtual DeclStmt *clone() const { return new DeclStmt( *this ); }447 virtual void accept( Visitor &v ) { v.visit( this ); }448 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }449 virtual void print( std::ostream &os, int indent = 0 ) const;447 virtual DeclStmt *clone() const override { return new DeclStmt( *this ); } 448 virtual void accept( Visitor &v ) override { v.visit( this ); } 449 virtual Statement *acceptMutator( Mutator &m ) override { return m.mutate( this ); } 450 virtual void print( std::ostream &os, Indenter indent = {} ) const override; 450 451 }; 451 452 … … 466 467 void set_callStmt( Statement * newValue ) { callStmt = newValue; } 467 468 468 virtual ImplicitCtorDtorStmt *clone() const { return new ImplicitCtorDtorStmt( *this ); } 469 virtual void accept( Visitor &v ) { v.visit( this ); } 470 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); } 471 virtual void print( std::ostream &os, int indent = 0 ) const; 472 }; 473 474 475 std::ostream & operator<<( std::ostream & out, const Statement * statement ); 469 virtual ImplicitCtorDtorStmt *clone() const override { return new ImplicitCtorDtorStmt( *this ); } 470 virtual void accept( Visitor &v ) override { v.visit( this ); } 471 virtual Statement *acceptMutator( Mutator &m ) override { return m.mutate( this ); } 472 virtual void print( std::ostream &os, Indenter indent = {} ) const override; 473 }; 476 474 477 475 // Local Variables: //
Note:
See TracChangeset
for help on using the changeset viewer.