Differences From Artifact [bcb9520d98]:
- File
bs/builtins/types/func/invoke.cpp
— part of check-in
[b3aeaae2df]
at
2020-01-11 18:28:15
on branch trunk
—
- Moved the cfg and lifetime management stuff into a CodeBuilder object owned by sema::Context. This is in preparation to allow alternative implementations of the builder, for instance to build classes.
- Pass the context to intrinsic functions, which removes their dependency to the parser the need for the ugly "GetCurrentParser" static function.
To Artifact [46c0a6fb82]:
- File bs/builtins/types/func/invoke.cpp — part of check-in [51c6751b6d] at 2020-05-21 17:26:11 on branch trunk — Created a new term type to represent holes in IR expressions. The old system of representing holes using a vector of two values led to ambiguousness when creating some rule patterns: a tuple whose both type vector and payload vector were holes would be indistinguishable from a tuple containing two elements. (user: achavasse size: 4479)
| ︙ | ︙ | |||
10 11 12 13 14 15 16 |
Value resolveInvocation( const Context& c, uint32_t loc, const Value& callee, const Value& args ) const final
{
optional< UnificationContext > bestUC;
optional< Term > bestSol;
bool ambiguous = false;
auto sig = GetFuncSig( callee );
| | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
Value resolveInvocation( const Context& c, uint32_t loc, const Value& callee, const Value& args ) const final
{
optional< UnificationContext > bestUC;
optional< Term > bestSol;
bool ambiguous = false;
auto sig = GetFuncSig( callee );
auto callPat = VEC( c.domain(), args.val(), HOLE( "_"_sid ) );
for( auto&& [s, uc] : FullUnify( sig, callPat, c ) )
{
if( !bestSol || uc.score() > bestUC->score() )
{
bestUC = uc;
bestSol = s;
ambiguous = false;
|
| ︙ | ︙ |