HLSL: Fix #1203: Declare anonymous members for cbuffer with no ';'
The grammar for no semicolon and no object name for cbuffer/tbuffer was correct, but the production still skipped the anonymous declarations if an identifier followed.
This commit is contained in:
@@ -376,7 +376,7 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& nodeList)
|
||||
|
||||
bool forbidDeclarators = (peekTokenClass(EHTokCBuffer) || peekTokenClass(EHTokTBuffer));
|
||||
// fully_specified_type
|
||||
if (! acceptFullySpecifiedType(declaredType, nodeList, declarator.attributes))
|
||||
if (! acceptFullySpecifiedType(declaredType, nodeList, declarator.attributes, forbidDeclarators))
|
||||
return false;
|
||||
|
||||
// cbuffer and tbuffer end with the closing '}'.
|
||||
@@ -583,7 +583,7 @@ bool HlslGrammar::acceptFullySpecifiedType(TType& type, const TAttributeMap& att
|
||||
TIntermNode* nodeList = nullptr;
|
||||
return acceptFullySpecifiedType(type, nodeList, attributes);
|
||||
}
|
||||
bool HlslGrammar::acceptFullySpecifiedType(TType& type, TIntermNode*& nodeList, const TAttributeMap& attributes)
|
||||
bool HlslGrammar::acceptFullySpecifiedType(TType& type, TIntermNode*& nodeList, const TAttributeMap& attributes, bool forbidDeclarators)
|
||||
{
|
||||
// type_qualifier
|
||||
TQualifier qualifier;
|
||||
@@ -611,7 +611,7 @@ bool HlslGrammar::acceptFullySpecifiedType(TType& type, TIntermNode*& nodeList,
|
||||
parseContext.transferTypeAttributes(attributes, type);
|
||||
|
||||
// further, it can create an anonymous instance of the block
|
||||
if (peek() != EHTokIdentifier)
|
||||
if (forbidDeclarators || peek() != EHTokIdentifier)
|
||||
parseContext.declareBlock(loc, type);
|
||||
} else {
|
||||
// Some qualifiers are set when parsing the type. Merge those with
|
||||
|
||||
Reference in New Issue
Block a user