Goose  Diff

Differences From Artifact [9ec63f3881]:

  • File bs/parse/parser.cpp — part of check-in [d40e6470bf] at 2021-10-26 18:43:49 on branch trunk — Type predicates: implemented helper functions to append / filter out type predicate hashes in identities. (user: zlodo size: 9705)

To Artifact [86f8bef3de]:

  • File bs/parse/parser.cpp — part of check-in [1ad61a2717] at 2021-11-11 20:05:58 on branch trunk — Refactored the code builder: it is now carried around as a Value, and accessed through a bunch of extension points, so we can have different builders (and even user defined ones) later to make classes etc. (user: zlodo size: 9658)

20
21
22
23
24
25
26
27

28
29
30
31
32
33
34
20
21
22
23
24
25
26

27
28
29
30
31
32
33
34







-
+








// Parse a sequence of expression. Each expression is
// a statement.
void Parser::parseSequence()
{
    for(;;)
    {
        CodeBuilder::LifetimeScopeGuard lsg( context() );
        LifetimeScopeGuard lsg( context() );

        {
            // Each statement gets its own visibility scope,
            // so that vars defined inside of the statement are only
            // visible from within it.
            // However, they also have a lifetime scope, which
            // is separate because we need to flush the value
74
75
76
77
78
79
80
81
82


83
84
85
86
87
88
89
74
75
76
77
78
79
80


81
82
83
84
85
86
87
88
89







-
-
+
+







        if( !parseInfix( next->first, *prec ) )
            break;
    }
}

void Parser::flushValue()
{
    const auto& cb = context().codeBuilder();
    if( m_lastValue && cb && cb->cfg() && ( !cb->cfg()->currentBB() || cb->cfg()->currentBB()->terminator() )  )
    auto cfg = GetCFG( context() );
    if( m_lastValue && cfg && ( !cfg->currentBB() || cfg->currentBB()->terminator() )  )
    {
        DiagnosticsManager::GetInstance().emitSyntaxErrorMessage(
            m_lastValue->locationId(), "unreachable code.", 0 );
    }

    // Flush the pending value, by invoking the DropValue
    // extension point, where an overload will decide