Goose  Diff

Differences From Artifact [5d1180010b]:

  • File bs/builtins/statements/if.cpp — part of check-in [3d8b581261] at 2019-08-15 22:37:33 on branch trunk —
    • Fixed some bugs related to dropping values.
    • Implemented local variable declarations with default initialization.
    • codegen: Fixed allocas not properly grouped up at the start of the first basic block of functions.
    (user: achavasse size: 4725)

To Artifact [f557ff1d9a]:

  • File bs/builtins/statements/if.cpp — part of check-in [9d81e31cfe] at 2019-08-18 14:51:10 on branch trunk —
    • Fixed speculative compile-time execution causing compilation failures.
    • Fixed compile time execution budget underflowing, leading to the compiler going into an infinte loop while compiling an infinite loop (erm...)
    • Fixed more cases of missing propagation of poison states leading to spurious error messages.
    (user: achavasse size: 4828)

11
12
13
14
15
16
17
18

19
20
21
22
23
24
25
11
12
13
14
15
16
17

18
19
20
21
22
23
24
25







-
+







{
    void SetupIfStmt( Env& e )
    {
        auto handleIf = []( Parser& p, uint32_t locationId, uint32_t prec )
        {
            auto& dm = DiagnosticsManager::GetInstance();

            if( p.isInParenExpr() )
            if( p.isInParenExpr() || !p.cfg() )
            {
                dm.emitSyntaxErrorMessage( locationId, "the if statement is not allowed here.", 0 );
                return false;
            }

            auto pPrecBB = p.currentBB();

52
53
54
55
56
57
58



59
60
61
62
63
64
65
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68







+
+
+







                    case ValUnifyError::Ambiguous:
                        dm.emitSyntaxErrorMessage( condVal->locationId(), "ambiguous if condition bool conversion." );
                        break;
                }

                return false;
            }

            if( get< Value >( converted ).isPoison() )
                p.cfg()->poison();

            auto pThenBB = ParseSubStatement( p, precedence::IfStmt );
            if( !pThenBB )
            {
                dm.emitSyntaxErrorMessage( p.resolver()->getCurrentLocation(), "expected a statement after the if condition.", 0 );
                return false;
            }