Goose  Diff

Differences From Artifact [2586afc097]:

  • File bs/builtins/types/localvar/localvar.cpp — part of check-in [0345b9f807] at 2021-01-02 18:00:11 on branch trunk — Some more renaming. (user: achavasse size: 9419)

To Artifact [3690d461e6]:

  • File bs/builtins/types/localvar/localvar.cpp — part of check-in [26c691ecb9] at 2021-01-02 18:24:23 on branch trunk — Yet one more reference/address refactor: each calculation step (getting temp addr, getting var addr, selecting a member) is now a separate cir instruction. We need this level of generalization to be able to obtain addresses from anywhere, including variables and function parameters. (user: achavasse size: 9444)

102
103
104
105
106
107
108
109

110
111
112
113
114
115
116
        // Create the _ texpr.
        static auto anyTVar = ValueToEIR( ToValue( TVar( "_"_sid ) ) );

        // The $T texpr.
        static auto TTVar = ValueToEIR( ToValue( TVar( "T"_sid ) ) );

        // Create the MutRef[$T] param.
        static auto mutRefParamPattern = ValueToEIR( ToValue( TNamedDecl( GetValueType< Reference >( TTVar, TSID( mut ) ), "ref"_sid ) ) );


        auto initValParamPattern = ValueToEIR( ToValue( Decl( initVal.type(), "initVal"_sid ) ) );

        // Create the _ ( MutRef[pat], initType ) initFunc param.
        auto initFuncTFTParam = ValueToEIR( ToValue(
            TNamedDecl( ValueToEIR( ToValue( TFuncType( anyTVar, VEC( move( mutRefParamPattern ), move( initValParamPattern ) ),
            make_shared< vector< TermLoc > >(), make_shared< vector< TermLoc > >() ) ) ), "initFunc"_sid ) ) );







|
>







102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
        // Create the _ texpr.
        static auto anyTVar = ValueToEIR( ToValue( TVar( "_"_sid ) ) );

        // The $T texpr.
        static auto TTVar = ValueToEIR( ToValue( TVar( "T"_sid ) ) );

        // Create the MutRef[$T] param.
        static auto mutRefParamPattern = ValueToEIR( ToValue( TNamedDecl(
            ValueToEIR( ToValue( ReferenceType{ TTVar, TSID( mut ) } ) ), "ref"_sid ) ) );

        auto initValParamPattern = ValueToEIR( ToValue( Decl( initVal.type(), "initVal"_sid ) ) );

        // Create the _ ( MutRef[pat], initType ) initFunc param.
        auto initFuncTFTParam = ValueToEIR( ToValue(
            TNamedDecl( ValueToEIR( ToValue( TFuncType( anyTVar, VEC( move( mutRefParamPattern ), move( initValParamPattern ) ),
            make_shared< vector< TermLoc > >(), make_shared< vector< TermLoc > >() ) ) ), "initFunc"_sid ) ) );