1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
-
+
-
+
-
|
#include "builtins/builtins.h"
#include "execute/execute.h"
namespace empathy::builtins
{
ptr< OverloadSet > CreateOverloadSet( Env& env, const StringId& name )
{
auto identity = AppendToVectorTerm( RootIdentity(), TERM( name ) );
auto pOvlSet = make_shared< OverloadSet >( identity );
env.storeValue( identity, ANYTERM( _ ), ValueToIRExpr( ToValue( pOvlSet ) ) );
return pOvlSet;
}
optional< Value > InvokeOverloadSet( const Context& c, const ptr< OverloadSet >& pOvlSet, const Value& args )
Value InvokeOverloadSet( const Context& c, const ptr< OverloadSet >& pOvlSet, const Value& args )
{
if( !pOvlSet )
assert( pOvlSet );
return nullopt;
Context localC( make_shared< Env >( *c.env() ), InjectDomainIntoIdentity( c.identity(), DomainCompileTime() ), GetValueType< uint32_t >() );
auto val = ResolveInvocation( localC, GetOverloadSetInvocationRule(), ToValue( pOvlSet ), args );
if( val.isConstant() || !llr::CanValueBeEagerlyEvaluated( val ) )
return val;
|