Changeset f80e0218 for src/SynTree/Statement.cc
- Timestamp:
- Jun 30, 2016, 4:32:56 PM (9 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- ea29e73
- Parents:
- 1b5c81ed (diff), 84d4d6f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Statement.cc
r1b5c81ed rf80e0218 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed Dec 09 14:09:34 201512 // Last Modified On : Thu May 12 13:33:18 2016 13 13 // Update Count : 54 14 14 // … … 43 43 44 44 void ExprStmt::print( std::ostream &os, int indent ) const { 45 os << string( indent, ' ' ) << "Expression Statement:" << endl;45 os << "Expression Statement:" << endl << std::string( indent + 2, ' ' ); 46 46 expr->print( os, indent + 2 ); 47 47 } … … 87 87 Statement( labels ), originalTarget( _target ), target( _target ), computedTarget( NULL ), type( _type ) { 88 88 //actually this is a syntactic error signaled by the parser 89 if ( type == BranchStmt::Goto && target. size() == 0)89 if ( type == BranchStmt::Goto && target.empty() ) 90 90 throw SemanticError("goto without target"); 91 91 } … … 110 110 111 111 void ReturnStmt::print( std::ostream &os, int indent ) const { 112 os << std::string( indent, ' ' ) << string ( isThrow? "Throw":"Return" ) << " Statement, returning: "; 113 if ( expr != 0 ) expr->print( os ); 112 os << string ( isThrow? "Throw":"Return" ) << " Statement, returning: "; 113 if ( expr != 0 ) { 114 os << endl << string( indent+2, ' ' ); 115 expr->print( os, indent + 2 ); 116 } 114 117 os << endl; 115 118 } … … 124 127 125 128 void IfStmt::print( std::ostream &os, int indent ) const { 126 os << string( indent, ' ' ) << "If on condition: " << endl ; 129 os << "If on condition: " << endl ; 130 os << string( indent+4, ' ' ); 127 131 condition->print( os, indent + 4 ); 128 132 129 os << string( indent, ' ' ) << ".... and branches: " << endl; 130 133 os << string( indent+2, ' ' ) << "... then: " << endl; 134 135 os << string( indent+4, ' ' ); 131 136 thenPart->print( os, indent + 4 ); 132 137 133 138 if ( elsePart != 0 ) { 139 os << string( indent+2, ' ' ) << "... else: " << endl; 140 os << string( indent+4, ' ' ); 134 141 elsePart->print( os, indent + 4 ); 135 142 } // if … … 153 160 154 161 void SwitchStmt::print( std::ostream &os, int indent ) const { 155 os << string( indent, ' ' ) <<"Switch on condition: ";162 os << "Switch on condition: "; 156 163 condition->print( os ); 157 164 os << endl; … … 218 225 219 226 void ChooseStmt::print( std::ostream &os, int indent ) const { 220 os << string( indent, ' ' ) <<"Choose on condition: ";227 os << "Choose on condition: "; 221 228 condition->print( os ); 222 229 os << endl; … … 247 254 248 255 void WhileStmt::print( std::ostream &os, int indent ) const { 249 os << string( indent, ' ' ) <<"While on condition: " << endl ;256 os << "While on condition: " << endl ; 250 257 condition->print( os, indent + 4 ); 251 258 … … 273 280 274 281 void ForStmt::print( std::ostream &os, int indent ) const { 275 os << string( indent, ' ' ) <<"Labels: {";282 os << "Labels: {"; 276 283 for ( std::list<Label>::const_iterator it = get_labels().begin(); it != get_labels().end(); ++it) { 277 284 os << *it << ","; … … 283 290 os << string( indent + 2, ' ' ) << "initialization: \n"; 284 291 for ( std::list<Statement *>::const_iterator it = initialization.begin(); it != initialization.end(); ++it ) { 292 os << string( indent + 4, ' ' ); 285 293 (*it)->print( os, indent + 4 ); 286 294 } 287 295 288 296 os << "\n" << string( indent + 2, ' ' ) << "condition: \n"; 289 if ( condition != 0 ) 297 if ( condition != 0 ) { 298 os << string( indent + 4, ' ' ); 290 299 condition->print( os, indent + 4 ); 300 } 291 301 292 302 os << "\n" << string( indent + 2, ' ' ) << "increment: \n"; 293 if ( increment != 0 ) 303 if ( increment != 0 ) { 304 os << string( indent + 4, ' ' ); 294 305 increment->print( os, indent + 4 ); 306 } 295 307 296 308 os << "\n" << string( indent + 2, ' ' ) << "statement block: \n"; 297 if ( body != 0 ) 309 if ( body != 0 ) { 310 os << string( indent + 4, ' ' ); 298 311 body->print( os, indent + 4 ); 312 } 299 313 300 314 os << endl; … … 314 328 315 329 void TryStmt::print( std::ostream &os, int indent ) const { 316 os << string( indent, ' ' ) <<"Try Statement" << endl;330 os << "Try Statement" << endl; 317 331 os << string( indent + 2, ' ' ) << "with block: " << endl; 318 332 block->print( os, indent + 4 ); … … 344 358 345 359 void CatchStmt::print( std::ostream &os, int indent ) const { 346 os << string( indent, ' ' ) <<"Catch Statement" << endl;360 os << "Catch Statement" << endl; 347 361 348 362 os << string( indent, ' ' ) << "... catching" << endl; … … 369 383 370 384 void FinallyStmt::print( std::ostream &os, int indent ) const { 371 os << string( indent, ' ' ) <<"Finally Statement" << endl;385 os << "Finally Statement" << endl; 372 386 os << string( indent + 2, ' ' ) << "with block: " << endl; 373 387 block->print( os, indent + 4 ); … … 378 392 379 393 void NullStmt::print( std::ostream &os, int indent ) const { 380 os << string( indent, ' ' ) << "Null Statement" << endl ; 394 os << "Null Statement" << endl ; 395 } 396 397 ImplicitCtorDtorStmt::ImplicitCtorDtorStmt( Statement * callStmt ) : Statement( std::list<Label>() ), callStmt( callStmt ) { 398 assert( callStmt ); 399 } 400 401 ImplicitCtorDtorStmt::ImplicitCtorDtorStmt( const ImplicitCtorDtorStmt & other ) : Statement( other ), callStmt( maybeClone( other.callStmt ) ) { 402 } 403 404 ImplicitCtorDtorStmt::~ImplicitCtorDtorStmt() { 405 delete callStmt; 406 } 407 408 void ImplicitCtorDtorStmt::print( std::ostream &os, int indent ) const { 409 os << "Implicit Ctor Dtor Statement" << endl; 410 os << string( indent + 2, ' ' ) << "with Ctor/Dtor: "; 411 callStmt->print( os, indent + 2); 412 os << endl; 381 413 } 382 414
Note:
See TracChangeset
for help on using the changeset viewer.