Goose  Diff

Differences From 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)

To Artifact [0e0c1c59c0]:

  • File bs/builtins/statements/hif.cpp — part of check-in [4464b9355c] at 2019-07-31 10:10:18 on branch trunk — Small cleanup. (user: achavasse size: 4276)

32
33
34
35
36
37
38
39

40
41
42
43
44
45
46
47
48
49
50
51
52
53
54

55
56
57
58
59
60
61

62
63
64
65
66
67
68
32
33
34
35
36
37
38

39
40
41
42
43
44
45
46
47
48
49
50
51
52
53

54
55
56
57
58
59
60

61
62
63
64
65
66
67
68







-
+














-
+






-
+







            const auto& context = p.resolver()->context();
            auto converted = ConvertValueToType( context, *condVal, GetValueType< bool >() );
            if( holds_alternative< ValUnifyError >( converted ) )
            {
                switch( get< ValUnifyError >( converted ) )
                {
                    case ValUnifyError::NoSolution:
                        cout << "#if condition doesn't evaluate to a bool constant1.\n";
                        cout << "#if condition doesn't evaluate to a bool constant.\n";
                        break;

                    case ValUnifyError::Ambiguous:
                        cout << "ambiguous #if condition bool conversion.\n";
                        break;
                }

                return false;
            }

            auto condBool = get< Value >( converted );

            if( !condBool.isConstant() )
            {
                cout << "#if condition doesn't evaluate to a bool constant2.";
                cout << "#if condition doesn't evaluate to a bool constant.";
                return false;
            }

            auto cond = FromValue< bool >( condBool );
            if( !cond )
            {
                cout << "#if condition doesn't evaluate to a bool constant3.";
                cout << "#if condition doesn't evaluate to a bool constant.";
                return false;
            }

            auto next = p.resolver()->lookAheadUnresolved();
            if( !next )
            {
                cout << "#if: brace block expected.\n";