Changeset a32b204 for translator/SynTree/Statement.cc
- Timestamp:
- May 17, 2015, 1:19:35 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:
- 0dd3a2f
- Parents:
- b87a5ed
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
translator/SynTree/Statement.cc
rb87a5ed ra32b204 38 38 { 39 39 //actually this is a syntactic error signaled by the parser 40 if (type == BranchStmt::Goto && target.size() == 0)40 if (type == BranchStmt::Goto && target.size() == 0) 41 41 throw SemanticError("goto without target"); 42 42 } … … 46 46 Statement(labels), computedTarget(_computedTarget), type(_type) 47 47 { 48 if (type != BranchStmt::Goto || computedTarget == 0)48 if (type != BranchStmt::Goto || computedTarget == 0) 49 49 throw SemanticError("Computed target not valid in branch statement"); 50 50 } … … 63 63 void ReturnStmt::print( std::ostream &os, int indent ){ 64 64 os << "\r" << std::string(indent, ' ') << string ( isThrow? "Throw":"Return" ) << " Statement, returning: "; 65 if (expr != 0) expr->print(os);65 if (expr != 0) expr->print(os); 66 66 os << endl; 67 67 } … … 81 81 thenPart->print(os, indent + 4); 82 82 83 if (elsePart != 0){83 if (elsePart != 0){ 84 84 elsePart->print(os, indent + 4); 85 85 } … … 104 104 // branches 105 105 std::list<Statement *>::iterator i; 106 for (i = branches.begin(); i != branches.end(); i++)106 for (i = branches.begin(); i != branches.end(); i++) 107 107 (*i)->print(os, indent + 4); 108 108 … … 115 115 Statement(_labels), condition(_condition), stmts(_statements), _isDefault(deflt) 116 116 { 117 if (isDefault() && condition != 0)117 if (isDefault() && condition != 0) 118 118 throw SemanticError("default with conditions"); 119 119 } … … 126 126 os << "\r" << string(indent, ' '); 127 127 128 if (isDefault())128 if (isDefault()) 129 129 os << "Default "; 130 130 else { … … 136 136 137 137 std::list<Statement *>::iterator i; 138 for (i = stmts.begin(); i != stmts.end(); i++)138 for (i = stmts.begin(); i != stmts.end(); i++) 139 139 (*i)->print(os, indent + 4); 140 140 } … … 158 158 // branches 159 159 std::list<Statement *>::iterator i; 160 for (i = branches.begin(); i != branches.end(); i++)160 for (i = branches.begin(); i != branches.end(); i++) 161 161 (*i)->print(os, indent + 4); 162 162 … … 183 183 os << string(indent, ' ') << ".... with body: " << endl; 184 184 185 if (body != 0) body->print(os, indent + 4);185 if (body != 0) body->print(os, indent + 4); 186 186 } 187 187 … … 216 216 217 217 os << "\n\r" << string(indent + 2, ' ') << "statement block: \n"; 218 if (body != 0)218 if (body != 0) 219 219 body->print(os, indent + 4); 220 220 … … 244 244 os << string(indent + 2, ' ') << "and handlers: " << endl; 245 245 std::list<Statement *>::iterator i; 246 for (i = handlers.begin(); i != handlers.end(); i++)246 for (i = handlers.begin(); i != handlers.end(); i++) 247 247 (*i)->print(os, indent + 4); 248 248 … … 267 267 268 268 os << "\r" << string(indent, ' ') << "... catching" << endl; 269 if ( decl ) {269 if ( decl ) { 270 270 decl->printShort( os, indent + 4 ); 271 271 os << endl;
Note: See TracChangeset
for help on using the changeset viewer.