Changeset a4da45e for src/ResolvExpr/CandidateFinder.cpp
- Timestamp:
- Feb 26, 2024, 3:53:42 AM (5 months ago)
- Branches:
- master
- Children:
- 3f9a8d0
- Parents:
- 0522ebe (diff), 022bce0 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/CandidateFinder.cpp
r0522ebe ra4da45e 1018 1018 } 1019 1019 1020 if (argType.as<ast::PointerType>()) funcFinder.otypeKeys.insert(Mangle::Encoding::pointer); 1020 if (argType.as<ast::PointerType>()) funcFinder.otypeKeys.insert(Mangle::Encoding::pointer); 1021 1021 else funcFinder.otypeKeys.insert(Mangle::mangle(argType, Mangle::NoGenericParams | Mangle::Type)); 1022 1022 } … … 1283 1283 restructureCast( cand->expr, toType, castExpr->isGenerated ), 1284 1284 copy( cand->env ), std::move( open ), std::move( need ), cand->cost + thisCost); 1285 // currently assertions are always resolved immediately so this should have no effect. 1285 // currently assertions are always resolved immediately so this should have no effect. 1286 1286 // if this somehow changes in the future (e.g. delayed by indeterminate return type) 1287 1287 // we may need to revisit the logic. … … 1618 1618 void Finder::postvisit( const ast::ConditionalExpr * conditionalExpr ) { 1619 1619 // candidates for condition 1620 ast::ptr<ast::Expr> arg1 = notZeroExpr( conditionalExpr->arg1 ); 1620 1621 CandidateFinder finder1( context, tenv ); 1621 ast::ptr<ast::Expr> arg1 = notZeroExpr( conditionalExpr->arg1 );1622 1622 finder1.find( arg1, ResolveMode::withAdjustment() ); 1623 1623 if ( finder1.candidates.empty() ) return; 1624 1624 1625 1625 // candidates for true result 1626 // FIX ME: resolves and runs arg1 twice when arg2 is missing. 1627 ast::Expr const * arg2 = conditionalExpr->arg2; 1628 arg2 = arg2 ? arg2 : conditionalExpr->arg1.get(); 1626 1629 CandidateFinder finder2( context, tenv ); 1627 1630 finder2.allowVoid = true; 1628 finder2.find( conditionalExpr->arg2, ResolveMode::withAdjustment() );1631 finder2.find( arg2, ResolveMode::withAdjustment() ); 1629 1632 if ( finder2.candidates.empty() ) return; 1630 1633 … … 1897 1900 CandidateRef newCand = 1898 1901 std::make_shared<Candidate>( 1899 newExpr, copy( tenv ), ast::OpenVarSet{}, 1902 newExpr, copy( tenv ), ast::OpenVarSet{}, 1900 1903 ast::AssertionSet{}, Cost::zero, cost 1901 1904 ); 1902 1905 1903 1906 if (newCand->expr->env) { 1904 1907 newCand->env.add(*newCand->expr->env);
Note: See TracChangeset
for help on using the changeset viewer.