Front-end: Add error-recovery code for a switch statement that ends with a case/default that has no statements.

This commit is contained in:
John Kessenich 2015-07-18 11:13:14 -06:00
parent 51b31b5785
commit 2b4b9bd65b
3 changed files with 14 additions and 1 deletions

View file

@ -5287,6 +5287,11 @@ TIntermNode* TParseContext::addSwitch(TSourceLoc loc, TIntermTyped* expression,
error(loc, "last case/default label not followed by statements", "switch", "");
else
warn(loc, "last case/default label not followed by statements", "switch", "");
// emulate a break for error recovery
lastStatements = intermediate.makeAggregate(intermediate.addBranch(EOpBreak, loc));
lastStatements->setOperator(EOpSequence);
switchSequence->push_back(lastStatements);
}
TIntermAggregate* body = new TIntermAggregate(EOpSequence);