if (node == nullptr)
return false;
+ ++parseContext.controlFlowNestingLevel; // this only needs to work right if no errors
+
TIntermTyped* trueNode = nullptr;
if (! acceptExpression(trueNode)) {
expected("expression after ?");
return false;
}
+ --parseContext.controlFlowNestingLevel;
+
node = intermediate.addSelection(node, trueNode, falseNode, loc);
return true;
// create the child statements
TIntermNodePair thenElse = { nullptr, nullptr };
+ ++parseContext.controlFlowNestingLevel; // this only needs to work right if no errors
+
// then statement
if (! acceptScopedStatement(thenElse.node1)) {
expected("then statement");
// Put the pieces together
statement = intermediate.addSelection(condition, thenElse, loc);
parseContext.popScope();
+ --parseContext.controlFlowNestingLevel;
return true;
}
// compound_statement
parseContext.pushSwitchSequence(new TIntermSequence);
+
+ ++parseContext.controlFlowNestingLevel;
bool statementOkay = acceptCompoundStatement(statement);
+ --parseContext.controlFlowNestingLevel;
+
if (statementOkay)
statement = parseContext.addSwitch(loc, switchExpression, statement ? statement->getAsAggregate() : nullptr);
case EHTokWhile:
// so that something declared in the condition is scoped to the lifetime
// of the while sub-statement
- parseContext.pushScope();
+ parseContext.pushScope(); // this only needs to work right if no errors
parseContext.nestLooping();
+ ++parseContext.controlFlowNestingLevel;
// LEFT_PAREN condition RIGHT_PAREN
if (! acceptParenExpression(condition))
parseContext.unnestLooping();
parseContext.popScope();
+ --parseContext.controlFlowNestingLevel;
statement = intermediate.addLoop(statement, condition, nullptr, true, loc, control);
return true;
case EHTokDo:
- parseContext.nestLooping();
+ parseContext.nestLooping(); // this only needs to work right if no errors
+ ++parseContext.controlFlowNestingLevel;
// statement
if (! acceptScopedStatement(statement)) {
expected(";");
parseContext.unnestLooping();
+ --parseContext.controlFlowNestingLevel;
statement = intermediate.addLoop(statement, condition, 0, false, loc, control);
if (! acceptSimpleStatement(initNode))
expected("for-loop initializer statement");
- parseContext.nestLooping();
+ parseContext.nestLooping(); // this only needs to work right if no errors
+ ++parseContext.controlFlowNestingLevel;
// condition SEMI_COLON
acceptExpression(condition);
parseContext.popScope();
parseContext.unnestLooping();
+ --parseContext.controlFlowNestingLevel;
return true;
}