Goose  Diff

Differences From Artifact [f6b5c33263]:

  • File bs/builtins/operators/helpers.h — part of check-in [7dcd0447a3] at 2019-09-22 22:42:49 on branch trunk — Implemented overloads of boolean or/and operators for verification expressions that don't do shortcut evaluation but simply emit the corresponding llr instruction. (user: achavasse size: 4553)

To Artifact [b30f62a396]:

  • File bs/builtins/operators/helpers.h — 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: 4577)

62
63
64
65
66
67
68
69

70
71
72
73
74
75
76
77
78
79

80
81
82
83
84
85
86
87
88
89
90
91
92
93
94

95
96
97
98
99
100
101
62
63
64
65
66
67
68

69
70
71
72
73
74
75
76
77
78

79
80
81
82
83
84
85
86
87
88
89
90
91
92
93

94
95
96
97
98
99
100
101







-
+









-
+














-
+







    {
        auto pOvlSet = GetOrCreateOverloadSet( e, funcName );
        ( ( ruleBuilders( e, pOvlSet, tag() ) ), ... );

        return [pOvlSet, funcName]< typename... O >( Parser& p, O&&... operands )
        {
            DiagnosticsContext dc( 0, format( "When invoking {}.", funcName ) );
            return InvokeOverloadSet( p.resolver()->context(), pOvlSet, MakeTuple( operands... ) );
            return InvokeOverloadSet( p.context(), pOvlSet, MakeTuple( operands... ) );
        };
    }

    template< typename T, typename I, typename RT = T >
    auto ForType()
    {
        return []< typename tag >( auto&& e, auto&& pOvlSet, tag t )
        {
            using intrinsicType = Intrinsic< Value ( T, T ) >;
            auto intrinsicFunc = []( const Value& lhs, const Value& rhs )
            auto intrinsicFunc = []( const Context& c, const Value& lhs, const Value& rhs )
            {
                return BuildComputedValue( GetValueType< RT >(), I( lhs, rhs ) );
            };

            pOvlSet->add( e, ToValue< intrinsicType >( move( intrinsicFunc ) ), GetFuncInvocationRule() );
        };
    }

    template< typename T, typename I, typename RT = T >
    auto ForVerificationType()
    {
        return []< typename tag >( auto&& e, auto&& pOvlSet, tag t )
        {
            using intrinsicType = VerificationIntrinsic< Value ( T, T ) >;
            auto intrinsicFunc = []( const Value& lhs, const Value& rhs )
            auto intrinsicFunc = []( const Context& c, const Value& lhs, const Value& rhs )
            {
                return BuildComputedValue( GetValueType< RT >(), I( lhs, rhs ) );
            };

            pOvlSet->add( e, ToValue< intrinsicType >( move( intrinsicFunc ) ), GetFuncInvocationRule() );
        };
    }