Changes in src/SynTree/Statement.h [ee3c93d:e67991f]
- File:
-
- 1 edited
-
src/SynTree/Statement.h (modified) (23 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Statement.h
ree3c93d re67991f 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Mar 8 14:53:02 201813 // Update Count : 7812 // Last Modified On : Tue Mar 12 09:01:53 2019 13 // Update Count : 83 14 14 // 15 15 … … 19 19 #include <list> // for list 20 20 #include <memory> // for allocator 21 #include <vector> // for vector21 #include <vector> // for vector 22 22 23 23 #include "BaseSyntaxNode.h" // for BaseSyntaxNode … … 43 43 const std::list<Label> & get_labels() const { return labels; } 44 44 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; 49 50 }; 50 51 … … 55 56 CompoundStmt(); 56 57 CompoundStmt( std::list<Statement *> stmts ); 57 CompoundStmt( const CompoundStmt & other );58 CompoundStmt( const CompoundStmt & other ); 58 59 virtual ~CompoundStmt(); 59 60 … … 62 63 void push_front( Statement * stmt ) { kids.push_front( stmt ); } 63 64 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; 68 70 }; 69 71 … … 72 74 NullStmt( const std::list<Label> & labels = {} ); 73 75 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; 78 81 }; 79 82 80 83 class ExprStmt : public Statement { 81 84 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 ); 86 89 virtual ~ExprStmt(); 87 90 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; 95 99 }; 96 100 … … 98 102 public: 99 103 bool voltile; 100 Expression * instruction;104 Expression * instruction; 101 105 std::list<Expression *> output, input; 102 106 std::list<ConstantExpr *> clobber; 103 107 std::list<Label> gotolabels; 104 108 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 ); 107 111 virtual ~AsmStmt(); 108 112 … … 114 118 void set_output( const std::list<Expression *> & newValue ) { output = newValue; } 115 119 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; } 117 121 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; } 119 123 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; 126 131 }; 127 132 … … 133 138 virtual ~DirectiveStmt(){} 134 139 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; 139 145 }; 140 146 141 147 class IfStmt : public Statement { 142 148 public: 143 Expression * condition;144 Statement * thenPart;145 Statement * elsePart;149 Expression * condition; 150 Statement * thenPart; 151 Statement * elsePart; 146 152 std::list<Statement *> initialization; 147 153 148 IfStmt( Expression * condition, Statement *thenPart, Statement *elsePart,154 IfStmt( Expression * condition, Statement * thenPart, Statement * elsePart, 149 155 std::list<Statement *> initialization = std::list<Statement *>() ); 150 IfStmt( const IfStmt & other );156 IfStmt( const IfStmt & other ); 151 157 virtual ~IfStmt(); 152 158 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; 165 172 }; 166 173 … … 170 177 std::list<Statement *> statements; 171 178 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 ); 174 181 virtual ~SwitchStmt(); 175 182 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; } 178 185 179 186 std::list<Statement *> & get_statements() { return statements; } 180 187 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; 186 194 187 195 }; … … 192 200 std::list<Statement *> stmts; 193 201 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 ); 196 204 virtual ~CaseStmt(); 197 205 … … 201 209 void set_default(bool b) { _isDefault = b; } 202 210 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; 214 223 private: 215 224 bool _isDefault; … … 218 227 class WhileStmt : public Statement { 219 228 public: 220 Expression * condition;221 Statement * body;229 Expression * condition; 230 Statement * body; 222 231 std::list<Statement *> initialization; 223 232 bool isDoWhile; 224 233 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 ); 228 236 virtual ~WhileStmt(); 229 237 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; } 234 242 bool get_isDoWhile() { return isDoWhile; } 235 243 void set_isDoWhile( bool newValue ) { isDoWhile = newValue; } 236 244 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; 241 250 }; 242 251 … … 244 253 public: 245 254 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 ); 253 261 virtual ~ForStmt(); 254 262 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; 267 276 }; 268 277 … … 274 283 const Label originalTarget; 275 284 Label target; 276 Expression * computedTarget;285 Expression * computedTarget; 277 286 Type type; 278 287 279 288 BranchStmt( Label target, Type ) throw (SemanticErrorException); 280 BranchStmt( Expression * computedTarget, Type ) throw (SemanticErrorException);289 BranchStmt( Expression * computedTarget, Type ) throw (SemanticErrorException); 281 290 282 291 Label get_originalTarget() { return originalTarget; } … … 284 293 void set_target( Label newValue ) { target = newValue; } 285 294 286 Expression * get_computedTarget() { return computedTarget; }295 Expression * get_computedTarget() { return computedTarget; } 287 296 void set_target( Expression * newValue ) { computedTarget = newValue; } 288 297 289 298 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; 296 306 private: 297 static const char * brType[];307 static const char * brType[]; 298 308 }; 299 309 300 310 class ReturnStmt : public Statement { 301 311 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 ); 306 316 virtual ~ReturnStmt(); 307 317 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; 315 326 }; 316 327 … … 324 335 325 336 ThrowStmt( Kind kind, Expression * expr, Expression * target = nullptr ); 326 ThrowStmt( const ThrowStmt & other );337 ThrowStmt( const ThrowStmt & other ); 327 338 virtual ~ThrowStmt(); 328 339 … … 333 344 void set_target( Expression * newTarget ) { target = newTarget; } 334 345 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; 339 351 }; 340 352 … … 345 357 FinallyStmt * finallyBlock; 346 358 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 ); 349 361 virtual ~TryStmt(); 350 362 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; } 353 365 std::list<CatchStmt *>& get_catchers() { return handlers; } 354 366 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; 362 375 }; 363 376 … … 367 380 368 381 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 ); 376 389 virtual ~CatchStmt(); 377 390 378 391 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; 390 404 }; 391 405 392 406 class FinallyStmt : public Statement { 393 407 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 ); 398 412 virtual ~FinallyStmt(); 399 413 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; 407 422 }; 408 423 … … 438 453 } orelse; 439 454 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 // }; 461 478 462 479 … … 464 481 class DeclStmt : public Statement { 465 482 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 ); 470 487 virtual ~DeclStmt(); 471 488 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 constructed484 /// 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. 485 502 class ImplicitCtorDtorStmt : public Statement { 486 503 public: … … 492 509 virtual ~ImplicitCtorDtorStmt(); 493 510 494 Statement * get_callStmt() const { return callStmt; }511 Statement * get_callStmt() const { return callStmt; } 495 512 void set_callStmt( Statement * newValue ) { callStmt = newValue; } 496 513 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; 501 519 }; 502 520
Note:
See TracChangeset
for help on using the changeset viewer.