Changeset 321f55d for src/Parser/StatementNode.cc
- Timestamp:
- Aug 10, 2016, 11:31:15 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, 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:
- 27fefeb6
- Parents:
- 2f22cc4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/StatementNode.cc
r2f22cc4 r321f55d 10 10 // Created On : Sat May 16 14:59:41 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 10 13:54:21201613 // Update Count : 17 012 // Last Modified On : Wed Aug 10 22:08:38 2016 13 // Update Count : 173 14 14 // 15 15 … … 224 224 case Case: 225 225 return new CaseStmt( labs, maybeBuild<Expression>(get_control() ), branches ); 226 assert( false ); 226 227 case Default: 227 228 return new CaseStmt( labs, 0, branches, true ); 229 assert( false ); 228 230 case While: 229 231 // assert( branches.size() == 1 ); … … 268 270 case Break: 269 271 return new BranchStmt( labs, get_target(), BranchStmt::Break ); 272 assert( false ); 270 273 case Continue: 271 274 return new BranchStmt( labs, get_target(), BranchStmt::Continue ); 275 assert( false ); 272 276 case Return: 273 277 case Throw : … … 314 318 std::list<Statement *> branches; 315 319 buildList<Statement, StatementNode>( then_stmt, branches ); 316 assert( branches.size() >= 1 );320 assert( branches.size() == 1 ); 317 321 thenb = branches.front(); 318 322 … … 320 324 std::list<Statement *> branches; 321 325 buildList<Statement, StatementNode>( else_stmt, branches ); 322 assert( branches.size() >= 1 );326 assert( branches.size() == 1 ); 323 327 elseb = branches.front(); 324 328 } // if … … 329 333 std::list<Statement *> branches; 330 334 buildList<Statement, StatementNode>( stmt, branches ); 331 assert( branches.size() >= 1 );335 assert( branches.size() >= 0 ); // size == 0 for switch (...) {}, i.e., no declaration or statements 332 336 return new SwitchStmt( noLabels, maybeBuild<Expression>(ctl), branches ); 337 } 338 Statement *build_case( ExpressionNode *ctl ) { 339 std::list<Statement *> branches; 340 buildList<Statement, StatementNode>( nullptr, branches ); 341 return new CaseStmt( noLabels, maybeBuild<Expression>(ctl), branches ); 342 } 343 Statement *build_default() { 344 std::list<Statement *> branches; 345 return new CaseStmt( noLabels, nullptr, branches, true ); 333 346 } 334 347 … … 360 373 delete forctl; 361 374 return new ForStmt( noLabels, init, cond, incr, branches.front() ); 375 } 376 377 Statement *build_branch( std::string identifier, BranchStmt::Type kind ) { 378 return new BranchStmt( noLabels, identifier, kind ); 362 379 } 363 380
Note: See TracChangeset
for help on using the changeset viewer.