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" );
|