Goose  Diff

Differences From Artifact [b4a2bc08f5]:

  • File bs/builtins/types/overloadset/helpers.cpp — part of check-in [1feb20f522] at 2019-08-13 22:43:49 on branch trunk — Cleanup: got rid of optional< Value > in a lot of places that ought to always return a poison value if an error happens. (user: achavasse size: 1034)

To Artifact [e47831c0df]:

  • File bs/builtins/types/overloadset/helpers.cpp — part of check-in [0288a69883] at 2019-08-13 23:27:36 on branch trunk — cleanup: got rid of more optional< Value >. (user: achavasse size: 998)

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;