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