Goose  Diff

Differences From Artifact [4aa50f69a6]:

  • File bs/builtins/statements/hif.cpp — part of check-in [1767c5b87e] at 2019-07-30 22:44:27 on branch trunk — Implemented the #if statement. (user: achavasse size: 4275)

To Artifact [e0c157b7ba]:

  • File bs/builtins/statements/hif.cpp — part of check-in [b288174776] at 2019-07-31 07:50:56 on branch trunk — Minor fixes. (user: achavasse size: 4279)

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
        auto handleHIf = []( Parser& p, const Term& t, uint32_t prec )
        {
            auto pPrecBB = p.currentBB();

            auto np = p.makeNestedParser();
            if( !np.parseExpression( precedence::IfStmt ) )
            {
                cout << "expected an expression following the #if statement.";
                return false;
            }

            auto condVal = np.popValue();
            if( !condVal )
            {
                cout << "expected an expression following the #if statement.";
                return false;
            }

            const auto& context = p.resolver()->context();
            auto converted = ConvertValueToType( context, *condVal, GetValueType< bool >() );
            if( holds_alternative< ValUnifyError >( converted ) )
            {







|






|







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
        auto handleHIf = []( Parser& p, const Term& t, uint32_t prec )
        {
            auto pPrecBB = p.currentBB();

            auto np = p.makeNestedParser();
            if( !np.parseExpression( precedence::IfStmt ) )
            {
                cout << "expected an expression following the #if statement.\n";
                return false;
            }

            auto condVal = np.popValue();
            if( !condVal )
            {
                cout << "expected an expression following the #if statement.\n";
                return false;
            }

            const auto& context = p.resolver()->context();
            auto converted = ConvertValueToType( context, *condVal, GetValueType< bool >() );
            if( holds_alternative< ValUnifyError >( converted ) )
            {