Goose  Diff

Differences From Artifact [298ad44e86]:

  • File bs/builtins/types/localvar/unify.cpp — part of check-in [238df77134] at 2019-11-19 00:04:49 on branch trunk — cfg: now that we got rid of this crazy system where CFGs could "call" other CFGs that weren't really functions, removed that clumsy cfg index that was needed to identify temporaries everywhere. (user: achavasse size: 2006)

To Artifact [956c9ccd05]:

  • File bs/builtins/types/localvar/unify.cpp — part of check-in [652107629a] at 2020-02-20 22:42:24 on branch trunk —
    • Wrap function parameters into local variables, which will make it easier later on to distinguish temporaries from stack values when implementing references.
    • Register parameters for destruction, which was missing.
    • Added an invocation rule for local variables, so that they can be invoked if they contain an invokable object.
    (user: achavasse size: 2074)

19
20
21
22
23
24
25

26

27
28
29
30
31

32
33
34
35
36
37
38
19
20
21
22
23
24
25
26

27
28
29
30
31

32
33
34
35
36
37
38
39







+
-
+




-
+







            ValueToIRExpr( ValuePattern(
                ANYTERM( _ ),
                localVarPattern,
                ANYTERM( _ ) ) ),

        []( const Term& lhs, const Term& rhs, UnificationContext& c ) -> UniGen
        {
            auto lvval = *ValueFromIRExpr( rhs );
            auto locvar = FromValue< LocalVar >( *ValueFromIRExpr( rhs ) );
            auto locvar = FromValue< LocalVar >( lvval );
            if( !locvar )
                co_return;

            auto varcontent = ValueToIRExpr( BuildComputedValue( locvar->type(),
                GetVar( locvar->type(), locvar->index() ) ) );
                GetVar( locvar->type(), locvar->index() ) ).setLocationId( lvval.locationId() ) );

            // Unify the param with the var's content
            co_yield Unify( lhs, varcontent, c );
        } );

        // LocalVar unification against another LocalVar: unify their types.
        e.unificationRuleSet()->addSymRule(