Changeset 32b8144 for src/ResolvExpr/Resolver.cc
- Timestamp:
- Feb 17, 2017, 2:20:25 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 11f95ee
- Parents:
- e6512c8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/Resolver.cc
re6512c8 r32b8144 302 302 } 303 303 304 template< typename SwitchClass >305 void handleSwitchStmt( SwitchClass *switchStmt, SymTab::Indexer &visitor ) {304 void Resolver::visit( SwitchStmt *switchStmt ) { 305 ValueGuard< Type * > oldInitContext( initContext ); 306 306 Expression *newExpr; 307 newExpr = findIntegralExpression( switchStmt->get_condition(), visitor);307 newExpr = findIntegralExpression( switchStmt->get_condition(), *this ); 308 308 delete switchStmt->get_condition(); 309 309 switchStmt->set_condition( newExpr ); 310 310 311 visitor.Visitor::visit( switchStmt ); 312 } 313 314 void Resolver::visit( SwitchStmt *switchStmt ) { 315 handleSwitchStmt( switchStmt, *this ); 311 initContext = newExpr->get_result(); 312 Parent::visit( switchStmt ); 316 313 } 317 314 318 315 void Resolver::visit( CaseStmt *caseStmt ) { 316 if ( caseStmt->get_condition() ) { 317 assert( initContext ); 318 CastExpr * castExpr = new CastExpr( caseStmt->get_condition(), initContext->clone() ); 319 Expression * newExpr = findSingleExpression( castExpr, *this ); 320 castExpr = safe_dynamic_cast< CastExpr * >( newExpr ); 321 caseStmt->set_condition( castExpr->get_arg() ); 322 castExpr->set_arg( nullptr ); 323 delete castExpr; 324 } 319 325 Parent::visit( caseStmt ); 320 326 }
Note: See TracChangeset
for help on using the changeset viewer.