Changeset ebcb7ba
- Timestamp:
- Jan 29, 2018, 2:05:26 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:
- 93967c8, fee651f
- Parents:
- ff39851
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/AlternativeFinder.cc
rff39851 rebcb7ba 1558 1558 AlternativeFinder firstFinder( indexer, env ); 1559 1559 firstFinder.findWithAdjustment( conditionalExpr->get_arg1() ); 1560 if ( firstFinder.alternatives.empty() ) return; 1561 // find alternatives for true expression 1562 AlternativeFinder secondFinder( indexer, env ); 1563 secondFinder.findWithAdjustment( conditionalExpr->get_arg2() ); 1564 if ( secondFinder.alternatives.empty() ) return; 1565 // find alterantives for false expression 1566 AlternativeFinder thirdFinder( indexer, env ); 1567 thirdFinder.findWithAdjustment( conditionalExpr->get_arg3() ); 1568 if ( thirdFinder.alternatives.empty() ) return; 1560 1569 for ( AltList::const_iterator first = firstFinder.alternatives.begin(); first != firstFinder.alternatives.end(); ++first ) { 1561 // find alternatives for true expression1562 AlternativeFinder secondFinder( indexer, first->env );1563 secondFinder.findWithAdjustment( conditionalExpr->get_arg2() );1564 1570 for ( AltList::const_iterator second = secondFinder.alternatives.begin(); second != secondFinder.alternatives.end(); ++second ) { 1565 // find alterantives for false expression1566 AlternativeFinder thirdFinder( indexer, second->env );1567 thirdFinder.findWithAdjustment( conditionalExpr->get_arg3() );1568 1571 for ( AltList::const_iterator third = thirdFinder.alternatives.begin(); third != thirdFinder.alternatives.end(); ++third ) { 1572 TypeEnvironment compositeEnv; 1573 compositeEnv.simpleCombine( first->env ); 1574 compositeEnv.simpleCombine( second->env ); 1575 compositeEnv.simpleCombine( third->env ); 1576 1569 1577 // unify true and false types, then infer parameters to produce new alternatives 1570 1578 OpenVarSet openVars; 1571 1579 AssertionSet needAssertions, haveAssertions; 1572 Alternative newAlt( 0, third->env, first->cost + second->cost + third->cost );1580 Alternative newAlt( 0, compositeEnv, first->cost + second->cost + third->cost ); 1573 1581 Type* commonType = nullptr; 1574 1582 if ( unify( second->expr->get_result(), third->expr->get_result(), newAlt.env, needAssertions, haveAssertions, openVars, indexer, commonType ) ) {
Note: See TracChangeset
for help on using the changeset viewer.