HLSL: Fix #1214: check for nesting in loop/switch of break statements.
This commit is contained in:
		
							parent
							
								
									7420a761a3
								
							
						
					
					
						commit
						9b5668c8ef
					
				@ -3789,6 +3789,10 @@ bool HlslGrammar::acceptJumpStatement(TIntermNode*& statement)
 | 
				
			|||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case EHTokBreak:
 | 
					    case EHTokBreak:
 | 
				
			||||||
        statement = intermediate.addBranch(EOpBreak, token.loc);
 | 
					        statement = intermediate.addBranch(EOpBreak, token.loc);
 | 
				
			||||||
 | 
					        if (parseContext.loopNestingLevel == 0 && parseContext.switchSequenceStack.size() == 0) {
 | 
				
			||||||
 | 
					            expected("loop or switch");
 | 
				
			||||||
 | 
					            return false;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case EHTokDiscard:
 | 
					    case EHTokDiscard:
 | 
				
			||||||
        statement = intermediate.addBranch(EOpKill, token.loc);
 | 
					        statement = intermediate.addBranch(EOpKill, token.loc);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user