Changeset de62360d for src/SynTree/Statement.cc
- Timestamp:
- Jun 24, 2015, 4:04:19 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, string, with_gc
- Children:
- 94e0864d
- Parents:
- a1d5d2a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Statement.cc
ra1d5d2a rde62360d 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jun 5 07:51:04201513 // Update Count : 1512 // Last Modified On : Tue Jun 23 11:42:09 2015 13 // Update Count : 21 14 14 // 15 15 … … 30 30 Statement::Statement( std::list<Label> _labels ) : labels(_labels ) {} 31 31 32 void Statement::print( std::ostream &, int indent ) {}32 void Statement::print( std::ostream &, int indent ) const {} 33 33 34 34 Statement::~Statement() {} … … 38 38 ExprStmt::~ExprStmt() {} 39 39 40 void ExprStmt::print( std::ostream &os, int indent ) {40 void ExprStmt::print( std::ostream &os, int indent ) const { 41 41 os << string( indent, ' ' ) << "Expression Statement:" << endl; 42 42 expr->print( os, indent + 2 ); … … 58 58 } 59 59 60 void BranchStmt::print( std::ostream &os, int indent ) {60 void BranchStmt::print( std::ostream &os, int indent ) const { 61 61 os << string( indent, ' ' ) << "Branch (" << brType[type] << ")" << endl ; 62 62 } … … 68 68 } 69 69 70 void ReturnStmt::print( std::ostream &os, int indent ) {70 void ReturnStmt::print( std::ostream &os, int indent ) const { 71 71 os << std::string( indent, ' ' ) << string ( isThrow? "Throw":"Return" ) << " Statement, returning: "; 72 72 if ( expr != 0 ) expr->print( os ); … … 79 79 IfStmt::~IfStmt() {} 80 80 81 void IfStmt::print( std::ostream &os, int indent ) {81 void IfStmt::print( std::ostream &os, int indent ) const { 82 82 os << string( indent, ' ' ) << "If on condition: " << endl ; 83 83 condition->print( os, indent + 4 ); … … 103 103 void SwitchStmt::add_case( CaseStmt *c ) {} 104 104 105 void SwitchStmt::print( std::ostream &os, int indent ) {105 void SwitchStmt::print( std::ostream &os, int indent ) const { 106 106 os << string( indent, ' ' ) << "Switch on condition: "; 107 107 condition->print( os ); … … 109 109 110 110 // branches 111 std::list<Statement *>:: iterator i;111 std::list<Statement *>::const_iterator i; 112 112 for ( i = branches.begin(); i != branches.end(); i++) 113 (*i 113 (*i)->print( os, indent + 4 ); 114 114 115 115 //for_each( branches.begin(), branches.end(), mem_fun( bind1st(&Statement::print ), os )); … … 130 130 } 131 131 132 void CaseStmt::print( std::ostream &os, int indent ) {132 void CaseStmt::print( std::ostream &os, int indent ) const { 133 133 os << string( indent, ' ' ); 134 134 135 if ( isDefault() )135 if ( isDefault() ) 136 136 os << "Default "; 137 137 else { … … 142 142 os << endl; 143 143 144 std::list<Statement *>:: iterator i;144 std::list<Statement *>::const_iterator i; 145 145 for ( i = stmts.begin(); i != stmts.end(); i++) 146 146 (*i )->print( os, indent + 4 ); … … 158 158 void ChooseStmt::add_case( CaseStmt *c ) {} 159 159 160 void ChooseStmt::print( std::ostream &os, int indent ) {160 void ChooseStmt::print( std::ostream &os, int indent ) const { 161 161 os << string( indent, ' ' ) << "Choose on condition: "; 162 162 condition->print( os ); … … 164 164 165 165 // branches 166 std::list<Statement *>:: iterator i;166 std::list<Statement *>::const_iterator i; 167 167 for ( i = branches.begin(); i != branches.end(); i++) 168 168 (*i )->print( os, indent + 4 ); … … 171 171 } 172 172 173 void FallthruStmt::print( std::ostream &os, int indent ) {173 void FallthruStmt::print( std::ostream &os, int indent ) const { 174 174 os << string( indent, ' ' ) << "Fall-through statement" << endl; 175 175 } … … 183 183 } 184 184 185 void WhileStmt::print( std::ostream &os, int indent ) {185 void WhileStmt::print( std::ostream &os, int indent ) const { 186 186 os << string( indent, ' ' ) << "While on condition: " << endl ; 187 187 condition->print( os, indent + 4 ); … … 203 203 } 204 204 205 void ForStmt::print( std::ostream &os, int indent ) {205 void ForStmt::print( std::ostream &os, int indent ) const { 206 206 os << string( indent, ' ' ) << "Labels: {"; 207 for ( std::list<Label>::iterator it = get_labels().begin(); it != get_labels().end(); ++it) {207 for ( std::list<Label>::const_iterator it = get_labels().begin(); it != get_labels().end(); ++it) { 208 208 os << *it << ","; 209 209 } … … 245 245 } 246 246 247 void TryStmt::print( std::ostream &os, int indent ) {247 void TryStmt::print( std::ostream &os, int indent ) const { 248 248 os << string( indent, ' ' ) << "Try Statement" << endl; 249 249 os << string( indent + 2, ' ' ) << "with block: " << endl; … … 252 252 // handlers 253 253 os << string( indent + 2, ' ' ) << "and handlers: " << endl; 254 std::list<Statement *>::iterator i; 255 for ( i = handlers.begin(); i != handlers.end(); i++) 254 for ( std::list<Statement *>::const_iterator i = handlers.begin(); i != handlers.end(); i++) 256 255 (*i )->print( os, indent + 4 ); 257 256 … … 272 271 } 273 272 274 void CatchStmt::print( std::ostream &os, int indent ) {273 void CatchStmt::print( std::ostream &os, int indent ) const { 275 274 os << string( indent, ' ' ) << "Catch Statement" << endl; 276 275 … … 294 293 } 295 294 296 void FinallyStmt::print( std::ostream &os, int indent ) {295 void FinallyStmt::print( std::ostream &os, int indent ) const { 297 296 os << string( indent, ' ' ) << "Finally Statement" << endl; 298 297 os << string( indent + 2, ' ' ) << "with block: " << endl; … … 304 303 NullStmt::~NullStmt() {} 305 304 306 void NullStmt::print( std::ostream &os, int indent ) {305 void NullStmt::print( std::ostream &os, int indent ) const { 307 306 os << string( indent, ' ' ) << "Null Statement" << endl ; 308 307 }
Note: See TracChangeset
for help on using the changeset viewer.