Fix local variable hides function parameter for GLSL ES 1.0

GLSL ES 1.0 specifies that "a function body has a scope nested inside
the function’s definition". For GLSL ES 3.0, they form a single scope.
Both specs use the compound_statement_no_new_scope rule. This change
respects that while supporting both behaviors. It does not impact legacy
content since it makes things more permissive.

Change-Id: Ica40fbf4d24d441ca2288fe5d43c288161e16b89
Reviewed-on: https://swiftshader-review.googlesource.com/5055
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
diff --git a/src/OpenGL/compiler/glslang.y b/src/OpenGL/compiler/glslang.y
index 3030144..1ecf468 100644
--- a/src/OpenGL/compiler/glslang.y
+++ b/src/OpenGL/compiler/glslang.y
@@ -1591,9 +1591,11 @@
 function_definition
     : function_prototype {
         context->parseFunctionPrototype(@1, $1.function, &$1.intermAggregate);
+        if (context->getShaderVersion() == 100) context->symbolTable.push();
     }
     compound_statement_no_new_scope {
         $$ = context->addFunctionDefinition(*($1.function), $1.intermAggregate, $3, @1);
+        if (context->getShaderVersion() == 100) context->symbolTable.pop();
     }
     ;
 
diff --git a/src/OpenGL/compiler/glslang_tab.cpp b/src/OpenGL/compiler/glslang_tab.cpp
index 2e23afe..ad7bd4d 100644
--- a/src/OpenGL/compiler/glslang_tab.cpp
+++ b/src/OpenGL/compiler/glslang_tab.cpp
@@ -4831,6 +4831,7 @@
 
     {
         context->parseFunctionPrototype((yylsp[0]), (yyvsp[0].interm).function, &(yyvsp[0].interm).intermAggregate);
+        if (context->getShaderVersion() == 100) context->symbolTable.push();
     }
 
     break;
@@ -4839,6 +4840,7 @@
 
     {
         (yyval.interm.intermNode) = context->addFunctionDefinition(*((yyvsp[-2].interm).function), (yyvsp[-2].interm).intermAggregate, (yyvsp[0].interm.intermAggregate), (yylsp[-2]));
+        if (context->getShaderVersion() == 100) context->symbolTable.pop();
     }
 
     break;