Changeset bb666f64 for src/ResolvExpr/AlternativeFinder.cc
- Timestamp:
- Oct 25, 2017, 4:25:20 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:
- 13a6154
- Parents:
- 68195a6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/AlternativeFinder.cc
r68195a6 rbb666f64 319 319 Cost computeExpressionConversionCost( Expression *& actualExpr, Type * formalType, const SymTab::Indexer &indexer, const TypeEnvironment & env ) { 320 320 Cost convCost = computeConversionCost( actualExpr->result, formalType, indexer, env ); 321 // if ( convCost != Cost::zero ) { 322 323 // xxx - temporary -- ignore poly cost, since this causes some polymorphic functions to be cast, which causes the specialize 324 // pass to try to specialize them, which currently does not work. Once that is fixed, remove the next 3 lines and uncomment the 325 // previous line. 321 322 // if there is a non-zero conversion cost, ignoring poly cost, then the expression requires conversion. 323 // ignore poly cost for now, since this requires resolution of the cast to infer parameters and this 324 // does not currently work for the reason stated below. 326 325 Cost tmpCost = convCost; 327 326 tmpCost.incPoly( -tmpCost.get_polyCost() ); 328 327 if ( tmpCost != Cost::zero ) { 328 // if ( convCost != Cost::zero ) { 329 329 Type *newType = formalType->clone(); 330 330 env.apply( newType ); … … 914 914 thisCost.incSafe( discardedValues ); 915 915 Alternative newAlt( restructureCast( i->expr->clone(), toType ), i->env, i->cost, thisCost ); 916 // xxx - this doesn't work at the moment, since inferParameters requires an ApplicationExpr as the alternative.917 // Once this works, it should be possible to infer parameters on a cast expression and specialize any function.918 919 916 inferParameters( needAssertions, haveAssertions, newAlt, openVars, back_inserter( candidates ) ); 920 // candidates.emplace_back( std::move( newAlt ) );921 917 } // if 922 918 } // for … … 1297 1293 // count one safe conversion for each value that is thrown away 1298 1294 thisCost.incSafe( discardedValues ); 1299 candidates.push_back( Alternative( new InitExpr( restructureCast( alt.expr->clone(), toType ), initAlt.designation->clone() ), newEnv, alt.cost, thisCost ) ); 1295 Alternative newAlt( new InitExpr( restructureCast( alt.expr->clone(), toType ), initAlt.designation->clone() ), newEnv, alt.cost, thisCost ); 1296 inferParameters( needAssertions, haveAssertions, newAlt, openVars, back_inserter( candidates ) ); 1300 1297 } 1301 1298 }
Note: See TracChangeset
for help on using the changeset viewer.