HLSL: Fix #1214: check for nesting in loop/switch of break statements.

This commit is contained in:
John Kessenich 2018-01-09 22:32:42 -07:00
parent 7420a761a3
commit 9b5668c8ef

View File

@ -3789,6 +3789,10 @@ bool HlslGrammar::acceptJumpStatement(TIntermNode*& statement)
break;
case EHTokBreak:
statement = intermediate.addBranch(EOpBreak, token.loc);
if (parseContext.loopNestingLevel == 0 && parseContext.switchSequenceStack.size() == 0) {
expected("loop or switch");
return false;
}
break;
case EHTokDiscard:
statement = intermediate.addBranch(EOpKill, token.loc);