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