Goose  Diff

Differences From Artifact [2b1699bd1b]:

  • File bs/builtins/types/overloadset/helpers.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.
    (user: achavasse size: 2554)

To Artifact [f375a868db]:

  • File bs/builtins/types/overloadset/helpers.cpp — part of check-in [060e84f233] at 2020-06-20 19:59:21 on branch trunk — Verifier: some fixes to correctly handle tuples. Still not quite working yet. (user: achavasse size: 2740)

53
54
55
56
57
58
59
60
61
62
63
64
65








66
67
68
69
70
71
72
73
74
            case sema::Env::Status::AmbiguousMatch:
                throw logic_error( format( "fatal: ambiguous match for overload set {}", name ) );
        }

        return nullptr;
    }

    Value InvokeOverloadSet( const Context& c, const ptr< OverloadSet >& pOvlSet, const Value& args )
    {
        assert( pOvlSet );

        Context localC( c.env(), c.identity(), GetValueType< uint32_t >() );
        localC.setBuilder( c.codeBuilder() );








        auto val = ResolveInvocation( localC, GetOverloadSetInvocationRule(), ToValue( pOvlSet ), args );

        if( val.isConstant() || !llr::CanValueBeEagerlyEvaluated( val ) )
            return val;

        execute::VM vm;
        return execute::Evaluate( val, vm );
    }
}







|





>
>
>
>
>
>
>
>





<



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
78

79
80
81
            case sema::Env::Status::AmbiguousMatch:
                throw logic_error( format( "fatal: ambiguous match for overload set {}", name ) );
        }

        return nullptr;
    }

    Value InvokeOverloadSet( const Context& c, const ptr< OverloadSet >& pOvlSet, Value args )
    {
        assert( pOvlSet );

        Context localC( c.env(), c.identity(), GetValueType< uint32_t >() );
        localC.setBuilder( c.codeBuilder() );

        execute::VM vm;

        if( !args.isConstant() && llr::CanValueBeEagerlyEvaluated( args ) )
            args = execute::Evaluate( args, vm );
        if( args.isPoison() )
            return PoisonValue();

        auto val = ResolveInvocation( localC, GetOverloadSetInvocationRule(), ToValue( pOvlSet ), args );

        if( val.isConstant() || !llr::CanValueBeEagerlyEvaluated( val ) )
            return val;


        return execute::Evaluate( val, vm );
    }
}