Goose  Diff

Differences From Artifact [fcabd0914c]:

  • File bs/builtins/types/func/invoke.cpp — part of check-in [4b842721d2] at 2021-08-31 23:10:36 on branch trunk —
    • Added extension points to transform parameter types and function arguments
    • Fixed the incorrect type predicate type checking rule which should just preserve the argument's predicates as is
    • Fixed verification of return intructions that were checking the returned value's predicates, instead of the return type predicates (which happened to work anyway until the above fix)
    (user: achavasse size: 4066)

To Artifact [fc1ba776f0]:

  • File bs/builtins/types/func/invoke.cpp — part of check-in [bbd2c17c42] at 2021-09-01 23:26:05 on branch trunk — Some cleanup and small reorganization in preparation for implementing non builtin intrinsic functions (user: achavasse size: 4080)

52
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
82
83
                auto typeCheckedArgs = DropVectorTerm( typeCheckedCallPat, 1 );

                newCallee.setLocationId( loc );

                if( IsBuiltinFunc( newCallee ) )
                    return BuildComputedValue( typeCheckedRType, cir::Call( newCallee, move( typeCheckedArgs ) ) );

                if( IsIntrinsicFunc( newCallee ) )
                    return GetBuiltinIntrinsicFuncWrapper( newCallee )( c, move( typeCheckedArgs ) );

                auto ft = *FromValue< FuncType >( *ValueFromEIR( newCallee.type() ) );
                auto argList = BuildArgListForCall( c, ft, typeCheckedArgs );
                if( !argList )
                    return PoisonValue();
                return BuildComputedValue( typeCheckedRType, cir::Call( newCallee, move( *argList ) ) );
            }

            optional< Term > getSignature( const Value& callee ) const final
            {
                return GetFuncSig( callee );
            }

            Value prepareFunc( const Context& c, uint32_t funcValLocation, const Value& callee, const Term& typeCheckedCallPat, TypeCheckingContext& tcc ) const final
            {
                if( IsBuiltinFunc( callee ) || IsIntrinsicFunc( callee ) )
                    return callee;

                // TODO better description with the function's name if possible (we may need to explicitely store it in the func)
                DiagnosticsContext dc( 0, true );
                VerbosityContext vc( Verbosity::Normal, true );

                return CompileFunc( c, callee );







|
















|







52
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
82
83
                auto typeCheckedArgs = DropVectorTerm( typeCheckedCallPat, 1 );

                newCallee.setLocationId( loc );

                if( IsBuiltinFunc( newCallee ) )
                    return BuildComputedValue( typeCheckedRType, cir::Call( newCallee, move( typeCheckedArgs ) ) );

                if( IsBuiltinIntrinsicFunc( newCallee ) )
                    return GetBuiltinIntrinsicFuncWrapper( newCallee )( c, move( typeCheckedArgs ) );

                auto ft = *FromValue< FuncType >( *ValueFromEIR( newCallee.type() ) );
                auto argList = BuildArgListForCall( c, ft, typeCheckedArgs );
                if( !argList )
                    return PoisonValue();
                return BuildComputedValue( typeCheckedRType, cir::Call( newCallee, move( *argList ) ) );
            }

            optional< Term > getSignature( const Value& callee ) const final
            {
                return GetFuncSig( callee );
            }

            Value prepareFunc( const Context& c, uint32_t funcValLocation, const Value& callee, const Term& typeCheckedCallPat, TypeCheckingContext& tcc ) const final
            {
                if( IsBuiltinFunc( callee ) || IsBuiltinIntrinsicFunc( callee ) )
                    return callee;

                // TODO better description with the function's name if possible (we may need to explicitely store it in the func)
                DiagnosticsContext dc( 0, true );
                VerbosityContext vc( Verbosity::Normal, true );

                return CompileFunc( c, callee );