HLSL: Fix #754: recognize type casts in if-statements separately from declarations.

This commit is contained in:
John Kessenich
2017-03-06 18:18:37 -07:00
parent 621c0e3d69
commit 057df2935a
4 changed files with 63 additions and 24 deletions

View File

@@ -469,6 +469,12 @@ bool HlslGrammar::acceptControlDeclaration(TIntermNode*& node)
if (! acceptFullySpecifiedType(type))
return false;
// filter out type casts
if (peekTokenClass(EHTokLeftParen)) {
recedeToken();
return false;
}
// identifier
HlslToken idToken;
if (! acceptIdentifier(idToken)) {
@@ -3259,7 +3265,7 @@ void HlslGrammar::acceptArraySpecifier(TArraySizes*& arraySizes)
TSourceLoc loc = token.loc;
TIntermTyped* sizeExpr = nullptr;
// Array sizing expression is optional. If ommitted, array will be later sized by initializer list.
// Array sizing expression is optional. If omitted, array will be later sized by initializer list.
const bool hasArraySize = acceptAssignmentExpression(sizeExpr);
if (! acceptTokenClass(EHTokRightBracket)) {