Fix scope definition in ES 100. (#2379)

* Remove image2DShadow and other 3 tokens. Refine codes.

Remove image2DShadow and other 3 tokens. Refine codes.

* 110scope.vert has redefinition part of what's removed from 100scope.vert
This commit is contained in:
Chow 2020-09-14 22:00:48 +08:00 committed by GitHub
parent f8a5602c55
commit 3933d7d414
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 91 additions and 26 deletions

View file

@ -3842,6 +3842,14 @@ function_definition
: function_prototype {
$1.function = parseContext.handleFunctionDeclarator($1.loc, *$1.function, false /* not prototype */);
$1.intermNode = parseContext.handleFunctionDefinition($1.loc, *$1.function);
// For ES 100 only, according to ES shading language 100 spec: A function
// body has a scope nested inside the function's definition.
if (parseContext.profile == EEsProfile && parseContext.version == 100)
{
parseContext.symbolTable.push();
++parseContext.statementNestingLevel;
}
}
compound_statement_no_new_scope {
// May be best done as post process phase on intermediate code
@ -3857,6 +3865,17 @@ function_definition
$$->getAsAggregate()->setOptimize(parseContext.contextPragma.optimize);
$$->getAsAggregate()->setDebug(parseContext.contextPragma.debug);
$$->getAsAggregate()->setPragmaTable(parseContext.contextPragma.pragmaTable);
// Set currentFunctionType to empty pointer when goes outside of the function
parseContext.currentFunctionType = nullptr;
// For ES 100 only, according to ES shading language 100 spec: A function
// body has a scope nested inside the function's definition.
if (parseContext.profile == EEsProfile && parseContext.version == 100)
{
parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]);
--parseContext.statementNestingLevel;
}
}
;