Changeset fee651f
- Timestamp:
- Jan 29, 2018, 4:03:04 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:
- 5a73f0f
- Parents:
- ebcb7ba
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/AlternativeFinder.cc
rebcb7ba rfee651f 1544 1544 AlternativeFinder firstFinder( indexer, env ); 1545 1545 firstFinder.findWithAdjustment( logicalExpr->get_arg1() ); 1546 if ( firstFinder.alternatives.empty() ) return; 1547 AlternativeFinder secondFinder( indexer, env ); 1548 secondFinder.findWithAdjustment( logicalExpr->get_arg2() ); 1549 if ( secondFinder.alternatives.empty() ) return; 1546 1550 for ( AltList::const_iterator first = firstFinder.alternatives.begin(); first != firstFinder.alternatives.end(); ++first ) { 1547 AlternativeFinder secondFinder( indexer, first->env );1548 secondFinder.findWithAdjustment( logicalExpr->get_arg2() );1549 1551 for ( AltList::const_iterator second = secondFinder.alternatives.begin(); second != secondFinder.alternatives.end(); ++second ) { 1552 TypeEnvironment compositeEnv; 1553 compositeEnv.simpleCombine( first->env ); 1554 compositeEnv.simpleCombine( second->env ); 1555 1550 1556 LogicalExpr *newExpr = new LogicalExpr( first->expr->clone(), second->expr->clone(), logicalExpr->get_isAnd() ); 1551 alternatives.push_back( Alternative( newExpr, second->env, first->cost + second->cost ) );1557 alternatives.push_back( Alternative( newExpr, compositeEnv, first->cost + second->cost ) ); 1552 1558 } 1553 1559 } … … 1609 1615 AlternativeFinder firstFinder( indexer, env ); 1610 1616 firstFinder.findWithAdjustment( rangeExpr->get_low() ); 1617 if ( firstFinder.alternatives.empty() ) return; 1618 AlternativeFinder secondFinder( indexer, env ); 1619 secondFinder.findWithAdjustment( rangeExpr->get_high() ); 1620 if ( secondFinder.alternatives.empty() ) return; 1611 1621 for ( AltList::const_iterator first = firstFinder.alternatives.begin(); first != firstFinder.alternatives.end(); ++first ) { 1612 AlternativeFinder secondFinder( indexer, first->env );1613 secondFinder.findWithAdjustment( rangeExpr->get_high() );1614 1622 for ( AltList::const_iterator second = secondFinder.alternatives.begin(); second != secondFinder.alternatives.end(); ++second ) { 1623 TypeEnvironment compositeEnv; 1624 compositeEnv.simpleCombine( first->env ); 1625 compositeEnv.simpleCombine( second->env ); 1615 1626 OpenVarSet openVars; 1616 1627 AssertionSet needAssertions, haveAssertions; 1617 Alternative newAlt( 0, second->env, first->cost + second->cost );1628 Alternative newAlt( 0, compositeEnv, first->cost + second->cost ); 1618 1629 Type* commonType = nullptr; 1619 1630 if ( unify( first->expr->get_result(), second->expr->get_result(), newAlt.env, needAssertions, haveAssertions, openVars, indexer, commonType ) ) {
Note: See TracChangeset
for help on using the changeset viewer.