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