Changes in src/ResolvExpr/Resolver.cc [eeaea53:32b8144]
- File:
-
- 1 edited
-
src/ResolvExpr/Resolver.cc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/Resolver.cc
reeaea53 r32b8144 86 86 Resolver resolver; 87 87 acceptAll( translationUnit, resolver ); 88 #if 089 resolver.print( cerr );90 for ( std::list< Declaration * >::iterator i = translationUnit.begin(); i != translationUnit.end(); ++i ) {91 (*i)->print( std::cerr );92 (*i)->accept( resolver );93 } // for94 #endif95 88 } 96 89 … … 309 302 } 310 303 311 template< typename SwitchClass >312 void handleSwitchStmt( SwitchClass *switchStmt, SymTab::Indexer &visitor ) {304 void Resolver::visit( SwitchStmt *switchStmt ) { 305 ValueGuard< Type * > oldInitContext( initContext ); 313 306 Expression *newExpr; 314 newExpr = findIntegralExpression( switchStmt->get_condition(), visitor);307 newExpr = findIntegralExpression( switchStmt->get_condition(), *this ); 315 308 delete switchStmt->get_condition(); 316 309 switchStmt->set_condition( newExpr ); 317 310 318 visitor.Visitor::visit( switchStmt ); 319 } 320 321 void Resolver::visit( SwitchStmt *switchStmt ) { 322 handleSwitchStmt( switchStmt, *this ); 311 initContext = newExpr->get_result(); 312 Parent::visit( switchStmt ); 323 313 } 324 314 325 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 } 326 325 Parent::visit( caseStmt ); 327 326 }
Note:
See TracChangeset
for help on using the changeset viewer.