Make switch statements have their own nested scope (bug 11904).

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@25949 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2014-03-17 22:48:25 +00:00
parent c63759ef01
commit 71e01cbab9
4 changed files with 99 additions and 1 deletions

View file

@ -2255,14 +2255,18 @@ condition
switch_statement
: SWITCH LEFT_PAREN expression RIGHT_PAREN {
// start new switch sequence on the switch stack
++parseContext.controlFlowNestingLevel;
parseContext.switchSequenceStack.push_back(new TIntermSequence);
parseContext.switchLevel.push_back(parseContext.controlFlowNestingLevel);
parseContext.symbolTable.push();
}
LEFT_BRACE switch_statement_list RIGHT_BRACE {
$$ = parseContext.addSwitch($1.loc, $3, $7 ? $7->getAsAggregate() : 0);
delete parseContext.switchSequenceStack.back();
parseContext.switchSequenceStack.pop_back();
parseContext.switchLevel.pop_back();
parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]);
--parseContext.controlFlowNestingLevel;
}
;