HLSL: Non-functional: Don't process function name/parameters before expected a function declaration.

This commit is contained in:
John Kessenich
2017-03-08 18:53:51 -07:00
parent b7201f8ee6
commit 78388726eb
2 changed files with 14 additions and 8 deletions

View File

@@ -326,14 +326,20 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& nodeList)
HlslToken idToken;
TIntermAggregate* initializers = nullptr;
while (acceptIdentifier(idToken)) {
TString* fnName = idToken.string;
if (peekTokenClass(EHTokLeftParen)) {
// looks like function parameters
TString* fnName = idToken.string;
// Potentially rename shader entry point function. No-op most of the time.
parseContext.renameShaderFunction(fnName);
// Potentially rename shader entry point function. No-op most of the time.
parseContext.renameShaderFunction(fnName);
// function_parameters
TFunction& function = *new TFunction(fnName, declaredType);
if (!acceptFunctionParameters(function)) {
expected("function parameter list");
return false;
}
// function_parameters
TFunction& function = *new TFunction(fnName, declaredType);
if (acceptFunctionParameters(function)) {
// post_decls
acceptPostDecls(function.getWritableType().getQualifier());