Changeset 68f9c43 for src/SynTree/Statement.cc
- Timestamp:
- Mar 16, 2018, 5:15:02 PM (6 years ago)
- Branches:
- new-env, with_gc
- Children:
- 8d7bef2
- Parents:
- 6171841
- git-author:
- Aaron Moss <a3moss@…> (03/16/18 17:04:24)
- git-committer:
- Aaron Moss <a3moss@…> (03/16/18 17:15:02)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Statement.cc
r6171841 r68f9c43 44 44 } 45 45 46 Statement::~Statement() {}47 48 46 ExprStmt::ExprStmt( Expression *expr ) : Statement(), expr( expr ) {} 49 47 50 48 ExprStmt::ExprStmt( const ExprStmt &other ) : Statement( other ), expr( maybeClone( other.expr ) ) {} 51 52 ExprStmt::~ExprStmt() {53 delete expr;54 }55 49 56 50 void ExprStmt::print( std::ostream &os, Indenter indent ) const { … … 66 60 cloneAll( other.input, input ); 67 61 cloneAll( other.clobber, clobber ); 68 }69 70 AsmStmt::~AsmStmt() {71 delete instruction;72 deleteAll( output );73 deleteAll( input );74 deleteAll( clobber );75 62 } 76 63 … … 122 109 ReturnStmt::ReturnStmt( const ReturnStmt & other ) : Statement( other ), expr( maybeClone( other.expr ) ) {} 123 110 124 ReturnStmt::~ReturnStmt() {125 delete expr;126 }127 128 111 void ReturnStmt::print( std::ostream &os, Indenter indent ) const { 129 112 os << "Return Statement, returning: "; … … 141 124 Statement( other ), condition( maybeClone( other.condition ) ), thenPart( maybeClone( other.thenPart ) ), elsePart( maybeClone( other.elsePart ) ) { 142 125 cloneAll( other.initialization, initialization ); 143 }144 145 IfStmt::~IfStmt() {146 deleteAll( initialization );147 delete condition;148 delete thenPart;149 delete elsePart;150 126 } 151 127 … … 185 161 } 186 162 187 SwitchStmt::~SwitchStmt() {188 delete condition;189 // destroy statements190 deleteAll( statements );191 }192 193 163 void SwitchStmt::print( std::ostream &os, Indenter indent ) const { 194 164 os << "Switch on condition: "; … … 209 179 Statement( other ), condition( maybeClone(other.condition ) ), _isDefault( other._isDefault ) { 210 180 cloneAll( other.stmts, stmts ); 211 }212 213 CaseStmt::~CaseStmt() {214 delete condition;215 deleteAll( stmts );216 181 } 217 182 … … 243 208 } 244 209 245 WhileStmt::~WhileStmt() {246 delete body;247 delete condition;248 }249 250 210 void WhileStmt::print( std::ostream &os, Indenter indent ) const { 251 211 os << "While on condition: " << endl ; … … 265 225 cloneAll( other.initialization, initialization ); 266 226 267 }268 269 ForStmt::~ForStmt() {270 deleteAll( initialization );271 delete condition;272 delete increment;273 delete body;274 227 } 275 228 … … 311 264 ThrowStmt::ThrowStmt( const ThrowStmt &other ) : 312 265 Statement ( other ), kind( other.kind ), expr( maybeClone( other.expr ) ), target( maybeClone( other.target ) ) { 313 }314 315 ThrowStmt::~ThrowStmt() {316 delete expr;317 delete target;318 266 } 319 267 … … 336 284 } 337 285 338 TryStmt::~TryStmt() {339 delete block;340 deleteAll( handlers );341 delete finallyBlock;342 }343 344 286 void TryStmt::print( std::ostream &os, Indenter indent ) const { 345 287 os << "Try Statement" << endl; … … 370 312 } 371 313 372 CatchStmt::~CatchStmt() {373 delete decl;374 delete body;375 }376 377 314 void CatchStmt::print( std::ostream &os, Indenter indent ) const { 378 315 os << "Catch " << ((Terminate == kind) ? "Terminate" : "Resume") << " Statement" << endl; … … 397 334 398 335 FinallyStmt::FinallyStmt( const FinallyStmt & other ) : Statement( other ), block( maybeClone( other.block ) ) { 399 }400 401 FinallyStmt::~FinallyStmt() {402 delete block;403 336 } 404 337 … … 434 367 } 435 368 436 WaitForStmt::~WaitForStmt() {437 for( auto & clause : clauses ) {438 delete clause.target.function;439 deleteAll( clause.target.arguments );440 delete clause.statement;441 delete clause.condition;442 }443 444 delete timeout.time;445 delete timeout.statement;446 delete timeout.condition;447 448 delete orelse.statement;449 delete orelse.condition;450 }451 452 369 void WaitForStmt::print( std::ostream &os, Indenter indent ) const { 453 370 os << "Waitfor Statement" << endl; … … 460 377 WithStmt::WithStmt( const WithStmt & other ) : Statement( other ), stmt( maybeClone( other.stmt ) ) { 461 378 cloneAll( other.exprs, exprs ); 462 }463 WithStmt::~WithStmt() {464 deleteAll( exprs );465 delete stmt;466 379 } 467 380 … … 489 402 } 490 403 491 ImplicitCtorDtorStmt::~ImplicitCtorDtorStmt() {492 delete callStmt;493 }494 495 404 void ImplicitCtorDtorStmt::print( std::ostream &os, Indenter indent ) const { 496 405 os << "Implicit Ctor Dtor Statement" << endl;
Note: See TracChangeset
for help on using the changeset viewer.