Changeset 1d7b0a8 for src/ResolvExpr/AlternativeFinder.cc
- Timestamp:
- Jun 11, 2018, 2:50:06 PM (5 years ago)
- Branches:
- new-env
- Children:
- 6d53e779, 982f95d
- Parents:
- 8e18b8e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/AlternativeFinder.cc
r8e18b8e r1d7b0a8 233 233 } 234 234 235 void AlternativeFinder::find( Expression *expr, bool adjust, bool prune, bool failFast) {235 void AlternativeFinder::find( Expression *expr, ResolvMode mode ) { 236 236 PassVisitor<Finder> finder( *this ); 237 237 expr->accept( finder ); 238 if ( failFast && alternatives.empty() ) {238 if ( mode.failFast && alternatives.empty() ) { 239 239 PRINT( 240 240 std::cerr << "No reasonable alternatives for expression " << expr << std::endl; … … 242 242 SemanticError( expr, "No reasonable alternatives for expression " ); 243 243 } 244 if ( prune ) {244 if ( mode.prune ) { 245 245 auto oldsize = alternatives.size(); 246 246 PRINT( … … 250 250 AltList pruned; 251 251 pruneAlternatives( alternatives.begin(), alternatives.end(), back_inserter( pruned ) ); 252 if ( failFast && pruned.empty() ) {252 if ( mode.failFast && pruned.empty() ) { 253 253 std::ostringstream stream; 254 254 AltList winners; … … 269 269 } 270 270 // adjust types after pruning so that types substituted by pruneAlternatives are correctly adjusted 271 for ( AltList::iterator i = alternatives.begin(); i != alternatives.end(); ++i) {272 if ( adjust) {273 adjustExprType( i ->expr->get_result(), i->env, indexer );271 if ( mode.adjust ) { 272 for ( Alternative& i : alternatives ) { 273 adjustExprType( i.expr->result, i.env, indexer ); 274 274 } 275 275 } … … 283 283 284 284 void AlternativeFinder::findWithAdjustment( Expression *expr ) { 285 find( expr, true);285 find( expr, ResolvMode::withAdjustment() ); 286 286 } 287 287 288 288 void AlternativeFinder::findWithoutPrune( Expression * expr ) { 289 find( expr, true, false);289 find( expr, ResolvMode::withoutPrune() ); 290 290 } 291 291 292 292 void AlternativeFinder::maybeFind( Expression * expr ) { 293 find( expr, true, true, false);293 find( expr, ResolvMode::withoutFailFast() ); 294 294 } 295 295
Note: See TracChangeset
for help on using the changeset viewer.