Goose  Diff

Differences From Artifact [06a244597d]:

  • File bs/builtins/statements/while.cpp — part of check-in [20d317a921] at 2019-08-21 13:38:51 on branch trunk —
    • Automatically compile the samples during the build.
    • Added a --forcecolors to the front-end, since it can't detect whether colors are allowed when launched by Ninja.
    • while: if the condition evaluates to constant true and there is no break statement in the body, use a different code generation strategy to avoid generating a continuation block which makes a return statement mandatory after the loop even though it's unreachable.
    (user: achavasse size: 7180)

To Artifact [df27d47867]:

  • File bs/builtins/statements/while.cpp — part of check-in [c2b2425c0c] at 2019-08-26 00:18:30 on branch trunk — Implemented local variable destruction (through the DestroyValue() extension point), and setup proper visibility and lifetime rules for variables declared inside of statements. (user: achavasse size: 7366)

25
26
27
28
29
30
31




32
33
34
35
36
37
38

            if( !pPrecBB || pPrecBB->terminator() )
            {
                DiagnosticsManager::GetInstance().emitSyntaxErrorMessage(
                    locationId, "unreachable code.", 0 );
                p.cfg()->poison();
            }





            auto np = p.makeNestedParser();
            if( !np.parseExpression( precedence::IfStmt ) )
            {
                dm.emitSyntaxErrorMessage( locationId, "expected an expression following the while statement.", 0 );
                return false;
            }







>
>
>
>







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

            if( !pPrecBB || pPrecBB->terminator() )
            {
                DiagnosticsManager::GetInstance().emitSyntaxErrorMessage(
                    locationId, "unreachable code.", 0 );
                p.cfg()->poison();
            }

            // Create a scope for the entire while, so that any var declared
            // inside of the condition is alive and visible throughout the while.
            Scope s( p );

            auto np = p.makeNestedParser();
            if( !np.parseExpression( precedence::IfStmt ) )
            {
                dm.emitSyntaxErrorMessage( locationId, "expected an expression following the while statement.", 0 );
                return false;
            }