Changeset 6c3a988f for src/ResolvExpr/AlternativeFinder.cc
- Timestamp:
- Jan 5, 2017, 3:47:36 PM (6 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, 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:
- f831177
- Parents:
- 1e3d5b6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/AlternativeFinder.cc
r1e3d5b6 r6c3a988f 339 339 unifiableVars[ (*tyvar)->get_name() ] = TypeDecl::Data{ *tyvar }; 340 340 for ( std::list< DeclarationWithType* >::iterator assert = (*tyvar)->get_assertions().begin(); assert != (*tyvar)->get_assertions().end(); ++assert ) { 341 needAssertions[ *assert ] = true;341 needAssertions[ *assert ].isUsed = true; 342 342 } 343 343 /// needAssertions.insert( needAssertions.end(), (*tyvar)->get_assertions().begin(), (*tyvar)->get_assertions().end() ); … … 380 380 } 381 381 *out++ = arg; 382 return true;383 382 } else if ( actualIt != actualEnd ) { 384 383 // both actualType and formalType are atomic (non-tuple) types - if they unify … … 467 466 void addToIndexer( AssertionSet &assertSet, SymTab::Indexer &indexer ) { 468 467 for ( AssertionSet::iterator i = assertSet.begin(); i != assertSet.end(); ++i ) { 469 if ( i->second == true) {468 if ( i->second.isUsed ) { 470 469 i->first->accept( indexer ); 471 470 } … … 478 477 if ( begin == end ) { 479 478 if ( newNeed.empty() ) { 479 PRINT( 480 std::cerr << "all assertions satisfied, output alternative: "; 481 newAlt.print( std::cerr ); 482 std::cerr << std::endl; 483 ); 480 484 *out++ = newAlt; 481 485 return; … … 494 498 495 499 ForwardIterator cur = begin++; 496 if ( ! cur->second ) {500 if ( ! cur->second.isUsed ) { 497 501 inferRecursive( begin, end, newAlt, openVars, decls, newNeed, /*needParents,*/ level, indexer, out ); 498 502 return; // xxx - should this continue? previously this wasn't here, and it looks like it should be … … 538 542 assert( (*candidate)->get_uniqueId() ); 539 543 DeclarationWithType *candDecl = static_cast< DeclarationWithType* >( Declaration::declFromId( (*candidate)->get_uniqueId() ) ); 544 545 // everything with an empty idChain was pulled in by the current assertion. 546 // add current assertion's idChain + current assertion's ID so that the correct inferParameters can be found. 547 for ( auto & a : newerNeed ) { 548 if ( a.second.idChain.empty() ) { 549 a.second.idChain = cur->second.idChain; 550 a.second.idChain.push_back( curDecl->get_uniqueId() ); 551 } 552 } 553 540 554 //AssertionParentSet newNeedParents( needParents ); 541 555 // skip repeatingly-self-recursive assertion satisfaction … … 553 567 ) 554 568 ApplicationExpr *appExpr = static_cast< ApplicationExpr* >( newerAlt.expr ); 569 // follow the current assertion's ID chain to find the correct set of inferred parameters to add the candidate to (i.e. the set of inferred parameters belonging to the entity which requested the assertion parameter). 570 InferredParams * inferParameters = &appExpr->get_inferParams(); 571 for ( UniqueId id : cur->second.idChain ) { 572 inferParameters = (*inferParameters)[ id ].inferParams.get(); 573 } 555 574 // XXX: this is a memory leak, but adjType can't be deleted because it might contain assertions 556 appExpr->get_inferParams()[ curDecl->get_uniqueId() ] = ParamEntry( (*candidate)->get_uniqueId(), adjType->clone(), curDecl->get_type()->clone(), varExpr );575 (*inferParameters)[ curDecl->get_uniqueId() ] = ParamEntry( (*candidate)->get_uniqueId(), adjType->clone(), curDecl->get_type()->clone(), varExpr ); 557 576 inferRecursive( begin, end, newerAlt, newOpenVars, newDecls, newerNeed, /*newNeedParents,*/ level, indexer, out ); 558 577 } else {
Note: See TracChangeset
for help on using the changeset viewer.