Goose  Diff

Differences From Artifact [527ebb4978]:

  • File bs/builtins/types/overloadset/invoke.cpp — part of check-in [7bb051b826] at 2021-09-24 19:11:17 on branch trunk — Overload resolution: cache which overload was selected for a given argument tuple (user: achavasse size: 5067)

To Artifact [eaadd43ee0]:

  • File bs/builtins/types/overloadset/invoke.cpp — part of check-in [16dd587889] at 2021-11-16 21:18:12 on branch trunk — The details of creating a new visibility scope are now handled by the builder instead of being hardcoded in the parser (user: zlodo size: 5055)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "builtins/builtins.h"

//#define OVL_TC_DEBUG

using namespace goose::sema;

namespace goose::builtins
{
    class OverloadSetInvocationRule : public InvocationRule
    {
        public:
            Value resolveInvocation( const Context& c, LocationId loc, const Value& callee, const Term& args ) const final
            {
                ProfileZoneScoped;

                auto pOvlSet = *FromValue< ptr< OverloadSet > >( callee );

                #if TRACY_ENABLE
                    stringstream sstr;
                    sstr << pOvlSet->identity();
                    ProfileZoneName( sstr.str().c_str(), sstr.str().size() );
                #endif

                if( auto ovl = pOvlSet->getResolutionFromCache( args ) )
                    return ovl->pInvRule->resolveInvocation( c, loc, *ovl->callee, args );
                else
                    return resolve( c, loc, pOvlSet, args );
            }

        private:
            Value resolve( const Context& c, LocationId loc, const ptr< OverloadSet >& pOvlSet, const Term& args ) const
            {
                const OverloadSet::Overload* bestOvl = nullptr;
                optional< TypeCheckingContext > bestTCC;
                optional< Term > bestSol;

                {
                    ProfileZoneScopedN( "Overload resolution" );











|


















|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "builtins/builtins.h"

//#define OVL_TC_DEBUG

using namespace goose::sema;

namespace goose::builtins
{
    class OverloadSetInvocationRule : public InvocationRule
    {
        public:
            Value resolveInvocation( Context& c, LocationId loc, const Value& callee, const Term& args ) const final
            {
                ProfileZoneScoped;

                auto pOvlSet = *FromValue< ptr< OverloadSet > >( callee );

                #if TRACY_ENABLE
                    stringstream sstr;
                    sstr << pOvlSet->identity();
                    ProfileZoneName( sstr.str().c_str(), sstr.str().size() );
                #endif

                if( auto ovl = pOvlSet->getResolutionFromCache( args ) )
                    return ovl->pInvRule->resolveInvocation( c, loc, *ovl->callee, args );
                else
                    return resolve( c, loc, pOvlSet, args );
            }

        private:
            Value resolve( Context& c, LocationId loc, const ptr< OverloadSet >& pOvlSet, const Term& args ) const
            {
                const OverloadSet::Overload* bestOvl = nullptr;
                optional< TypeCheckingContext > bestTCC;
                optional< Term > bestSol;

                {
                    ProfileZoneScopedN( "Overload resolution" );