Changes in src/SynTree/Statement.cc [74d1804:3be261a]
- File:
-
- 1 edited
-
src/SynTree/Statement.cc (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Statement.cc
r74d1804 r3be261a 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Thu May 12 13:33:18 201612 // Last Modified On : Wed Dec 09 14:09:34 2015 13 13 // Update Count : 54 14 14 // … … 43 43 44 44 void ExprStmt::print( std::ostream &os, int indent ) const { 45 os << "Expression Statement:" << endl << std::string( indent + 2, ' ' );45 os << string( indent, ' ' ) << "Expression Statement:" << endl; 46 46 expr->print( os, indent + 2 ); 47 47 } … … 110 110 111 111 void ReturnStmt::print( std::ostream &os, int indent ) const { 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 } 112 os << std::string( indent, ' ' ) << string ( isThrow? "Throw":"Return" ) << " Statement, returning: "; 113 if ( expr != 0 ) expr->print( os ); 117 114 os << endl; 118 115 } … … 127 124 128 125 void IfStmt::print( std::ostream &os, int indent ) const { 129 os << "If on condition: " << endl ; 130 os << string( indent+4, ' ' ); 126 os << string( indent, ' ' ) << "If on condition: " << endl ; 131 127 condition->print( os, indent + 4 ); 132 128 133 os << string( indent+2, ' ' ) << "... then: " << endl; 134 135 os << string( indent+4, ' ' ); 129 os << string( indent, ' ' ) << ".... and branches: " << endl; 130 136 131 thenPart->print( os, indent + 4 ); 137 132 138 133 if ( elsePart != 0 ) { 139 os << string( indent+2, ' ' ) << "... else: " << endl;140 os << string( indent+4, ' ' );141 134 elsePart->print( os, indent + 4 ); 142 135 } // if … … 160 153 161 154 void SwitchStmt::print( std::ostream &os, int indent ) const { 162 os << "Switch on condition: ";155 os << string( indent, ' ' ) << "Switch on condition: "; 163 156 condition->print( os ); 164 157 os << endl; … … 225 218 226 219 void ChooseStmt::print( std::ostream &os, int indent ) const { 227 os << "Choose on condition: ";220 os << string( indent, ' ' ) << "Choose on condition: "; 228 221 condition->print( os ); 229 222 os << endl; … … 254 247 255 248 void WhileStmt::print( std::ostream &os, int indent ) const { 256 os << "While on condition: " << endl ;249 os << string( indent, ' ' ) << "While on condition: " << endl ; 257 250 condition->print( os, indent + 4 ); 258 251 … … 280 273 281 274 void ForStmt::print( std::ostream &os, int indent ) const { 282 os << "Labels: {";275 os << string( indent, ' ' ) << "Labels: {"; 283 276 for ( std::list<Label>::const_iterator it = get_labels().begin(); it != get_labels().end(); ++it) { 284 277 os << *it << ","; … … 290 283 os << string( indent + 2, ' ' ) << "initialization: \n"; 291 284 for ( std::list<Statement *>::const_iterator it = initialization.begin(); it != initialization.end(); ++it ) { 292 os << string( indent + 4, ' ' );293 285 (*it)->print( os, indent + 4 ); 294 286 } 295 287 296 288 os << "\n" << string( indent + 2, ' ' ) << "condition: \n"; 297 if ( condition != 0 ) { 298 os << string( indent + 4, ' ' ); 289 if ( condition != 0 ) 299 290 condition->print( os, indent + 4 ); 300 }301 291 302 292 os << "\n" << string( indent + 2, ' ' ) << "increment: \n"; 303 if ( increment != 0 ) { 304 os << string( indent + 4, ' ' ); 293 if ( increment != 0 ) 305 294 increment->print( os, indent + 4 ); 306 }307 295 308 296 os << "\n" << string( indent + 2, ' ' ) << "statement block: \n"; 309 if ( body != 0 ) { 310 os << string( indent + 4, ' ' ); 297 if ( body != 0 ) 311 298 body->print( os, indent + 4 ); 312 }313 299 314 300 os << endl; … … 328 314 329 315 void TryStmt::print( std::ostream &os, int indent ) const { 330 os << "Try Statement" << endl;316 os << string( indent, ' ' ) << "Try Statement" << endl; 331 317 os << string( indent + 2, ' ' ) << "with block: " << endl; 332 318 block->print( os, indent + 4 ); … … 358 344 359 345 void CatchStmt::print( std::ostream &os, int indent ) const { 360 os << "Catch Statement" << endl;346 os << string( indent, ' ' ) << "Catch Statement" << endl; 361 347 362 348 os << string( indent, ' ' ) << "... catching" << endl; … … 383 369 384 370 void FinallyStmt::print( std::ostream &os, int indent ) const { 385 os << "Finally Statement" << endl;371 os << string( indent, ' ' ) << "Finally Statement" << endl; 386 372 os << string( indent + 2, ' ' ) << "with block: " << endl; 387 373 block->print( os, indent + 4 ); … … 392 378 393 379 void NullStmt::print( std::ostream &os, int indent ) const { 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; 380 os << string( indent, ' ' ) << "Null Statement" << endl ; 413 381 } 414 382
Note:
See TracChangeset
for help on using the changeset viewer.