49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
if( !bestSol )
{
// TODO error mgmt
cout << "function arguments mismatch.\n";
return nullopt;
}
auto unifiedCallPat = Substitute( *bestSol, *bestUC );
auto callDecomp = Decompose( unifiedCallPat,
Vec(
SubTerm(), // args
SubTerm() // return type
)
);
auto&& [unifiedArgs, unifiedRType] = *callDecomp;
return Value( rtype, make_shared< llr::Element >( llr::Call( callee, unifiedArgs ) ) );
}
virtual Term getSignature( const Context& c, const Value& callee ) const final
{
return GetFuncSigAndRType( callee ).first;
}
};
|
>
>
>
>
>
|
|
|
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
if( !bestSol )
{
// TODO error mgmt
cout << "function arguments mismatch.\n";
return nullopt;
}
return resolveInvocation( c, callee, *bestSol, *bestUC );
}
optional< Value > resolveInvocation( const Context& c, const Value& callee, const Term& uniSol, UnificationContext& uc ) const final
{
auto unifiedCallPat = Substitute( uniSol, uc );
auto callDecomp = Decompose( unifiedCallPat,
Vec(
SubTerm(), // args
SubTerm() // return type
)
);
auto&& [unifiedArgs, unifiedRType] = *callDecomp;
return Value( unifiedRType, make_shared< llr::Element >( llr::Call( callee, unifiedArgs ) ) );
}
virtual Term getSignature( const Context& c, const Value& callee ) const final
{
return GetFuncSigAndRType( callee ).first;
}
};
|