Revert "Fix lots of variable shadowing in ANGLE"

Caused WebGL CTS failures on the texture-npot test:
https://www.khronos.org/registry/webgl/sdk/tests/conformance/textures/texture-npot.html

This reverts commit c67e6e9fade44ef8938724e82db11db725e9c8e5.

Change-Id: I089e99859231e0d657084ac3647257c650a9da92
Reviewed-on: https://chromium-review.googlesource.com/243041
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/compiler/translator/Compiler.cpp b/src/compiler/translator/Compiler.cpp
index 5eac0c5..d7d98b5 100644
--- a/src/compiler/translator/Compiler.cpp
+++ b/src/compiler/translator/Compiler.cpp
@@ -423,25 +423,25 @@
     nameMap.clear();
 }
 
-bool TCompiler::detectCallDepth(TIntermNode* inputRoot, TInfoSink& inputInfoSink, bool limitCallStackDepth)
+bool TCompiler::detectCallDepth(TIntermNode* root, TInfoSink& infoSink, bool limitCallStackDepth)
 {
-    DetectCallDepth detect(inputInfoSink, limitCallStackDepth, maxCallStackDepth);
-    inputRoot->traverse(&detect);
+    DetectCallDepth detect(infoSink, limitCallStackDepth, maxCallStackDepth);
+    root->traverse(&detect);
     switch (detect.detectCallDepth())
     {
       case DetectCallDepth::kErrorNone:
         return true;
       case DetectCallDepth::kErrorMissingMain:
-        inputInfoSink.info.prefix(EPrefixError);
-        inputInfoSink.info << "Missing main()";
+        infoSink.info.prefix(EPrefixError);
+        infoSink.info << "Missing main()";
         return false;
       case DetectCallDepth::kErrorRecursion:
-        inputInfoSink.info.prefix(EPrefixError);
-        inputInfoSink.info << "Function recursion detected";
+        infoSink.info.prefix(EPrefixError);
+        infoSink.info << "Function recursion detected";
         return false;
       case DetectCallDepth::kErrorMaxDepthExceeded:
-        inputInfoSink.info.prefix(EPrefixError);
-        inputInfoSink.info << "Function call stack too deep";
+        infoSink.info.prefix(EPrefixError);
+        infoSink.info << "Function call stack too deep";
         return false;
       default:
         UNREACHABLE();
diff --git a/src/compiler/translator/DetectCallDepth.cpp b/src/compiler/translator/DetectCallDepth.cpp
index 0dc5d22..bfc1d58 100644
--- a/src/compiler/translator/DetectCallDepth.cpp
+++ b/src/compiler/translator/DetectCallDepth.cpp
@@ -33,7 +33,7 @@
     ASSERT(visit == PreVisit);
     ASSERT(detectCallDepth);
 
-    int retMaxDepth = depth;
+    int maxDepth = depth;
     visit = InVisit;
     for (size_t i = 0; i < callees.size(); ++i) {
         switch (callees[i]->visit) {
@@ -52,7 +52,7 @@
                     detectCallDepth->getInfoSink().info << "<-" << callees[i]->getName();
                     return callDepth;
                 }
-                retMaxDepth = std::max(callDepth, retMaxDepth);
+                maxDepth = std::max(callDepth, maxDepth);
                 break;
             }
             default:
@@ -61,7 +61,7 @@
         }
     }
     visit = PostVisit;
-    return retMaxDepth;
+    return maxDepth;
 }
 
 void DetectCallDepth::FunctionNode::reset()
diff --git a/src/compiler/translator/OutputGLSLBase.cpp b/src/compiler/translator/OutputGLSLBase.cpp
index 8d8830c..b98f5d5 100644
--- a/src/compiler/translator/OutputGLSLBase.cpp
+++ b/src/compiler/translator/OutputGLSLBase.cpp
@@ -651,11 +651,11 @@
         for (TIntermSequence::const_iterator iter = node->getSequence()->begin();
              iter != node->getSequence()->end(); ++iter)
         {
-            TIntermNode *curNode = *iter;
-            ASSERT(curNode != NULL);
-            curNode->traverse(this);
+            TIntermNode *node = *iter;
+            ASSERT(node != NULL);
+            node->traverse(this);
 
-            if (isSingleStatement(curNode))
+            if (isSingleStatement(node))
                 out << ";\n";
         }
         decrementDepth();
diff --git a/src/compiler/translator/ParseContext.cpp b/src/compiler/translator/ParseContext.cpp
index e2959d7..de9295b 100644
--- a/src/compiler/translator/ParseContext.cpp
+++ b/src/compiler/translator/ParseContext.cpp
@@ -1077,14 +1077,14 @@
 //
 // Return the function symbol if found, otherwise 0.
 //
-const TFunction* TParseContext::findFunction(const TSourceLoc& line, TFunction* call, int inputShaderVersion, bool *builtIn)
+const TFunction* TParseContext::findFunction(const TSourceLoc& line, TFunction* call, int shaderVersion, bool *builtIn)
 {
     // First find by unmangled name to check whether the function name has been
     // hidden by a variable name or struct typename.
     // If a function is found, check for one with a matching argument list.
-    const TSymbol* symbol = symbolTable.find(call->getName(), inputShaderVersion, builtIn);
+    const TSymbol* symbol = symbolTable.find(call->getName(), shaderVersion, builtIn);
     if (symbol == 0 || symbol->isFunction()) {
-        symbol = symbolTable.find(call->getMangledName(), inputShaderVersion, builtIn);
+        symbol = symbolTable.find(call->getMangledName(), shaderVersion, builtIn);
     }
 
     if (symbol == 0) {
diff --git a/src/compiler/translator/ParseContext.h b/src/compiler/translator/ParseContext.h
index 23be57e..ed4b7b4 100644
--- a/src/compiler/translator/ParseContext.h
+++ b/src/compiler/translator/ParseContext.h
@@ -120,7 +120,7 @@
 
     bool containsSampler(TType& type);
     bool areAllChildConst(TIntermAggregate* aggrNode);
-    const TFunction* findFunction(const TSourceLoc& line, TFunction* pfnCall, int inputShaderVersion, bool *builtIn = 0);
+    const TFunction* findFunction(const TSourceLoc& line, TFunction* pfnCall, int shaderVersion, bool *builtIn = 0);
     bool executeInitializer(const TSourceLoc& line, const TString& identifier, TPublicType& pType,
                             TIntermTyped* initializer, TIntermNode*& intermNode, TVariable* variable = 0);
 
diff --git a/src/compiler/translator/QualifierAlive.cpp b/src/compiler/translator/QualifierAlive.cpp
index 3d950aa..1f6fb75 100644
--- a/src/compiler/translator/QualifierAlive.cpp
+++ b/src/compiler/translator/QualifierAlive.cpp
@@ -49,7 +49,7 @@
         found = true;
 }
 
-bool TAliveTraverser::visitSelection(Visit, TIntermSelection*)
+bool TAliveTraverser::visitSelection(Visit preVisit, TIntermSelection* node)
 {
     if (wasFound())
         return false;
diff --git a/src/compiler/translator/ShaderVars.cpp b/src/compiler/translator/ShaderVars.cpp
index 187b73e..3098a7f 100644
--- a/src/compiler/translator/ShaderVars.cpp
+++ b/src/compiler/translator/ShaderVars.cpp
@@ -86,6 +86,7 @@
     // 2) the top variable is an array;
     // 3) otherwise.
     size_t pos = mappedFullName.find_first_of(".[");
+    std::string topName;
 
     if (pos == std::string::npos)
     {
diff --git a/src/compiler/translator/StructureHLSL.cpp b/src/compiler/translator/StructureHLSL.cpp
index 304949b..48929af 100644
--- a/src/compiler/translator/StructureHLSL.cpp
+++ b/src/compiler/translator/StructureHLSL.cpp
@@ -274,9 +274,9 @@
 
     for (unsigned int parameter = 0; parameter < ctorParameters.size(); parameter++)
     {
-        const TType &paramType = ctorParameters[parameter];
+        const TType &type = ctorParameters[parameter];
 
-        constructor += TypeString(paramType) + " x" + str(parameter) + ArrayString(paramType);
+        constructor += TypeString(type) + " x" + str(parameter) + ArrayString(type);
 
         if (parameter < ctorParameters.size() - 1)
         {
diff --git a/src/compiler/translator/TranslatorESSL.cpp b/src/compiler/translator/TranslatorESSL.cpp
index 5f064f9..3b50f7d 100644
--- a/src/compiler/translator/TranslatorESSL.cpp
+++ b/src/compiler/translator/TranslatorESSL.cpp
@@ -46,9 +46,9 @@
 
 void TranslatorESSL::writeExtensionBehavior() {
     TInfoSinkBase& sink = getInfoSink().obj;
-    const TExtensionBehavior& extBehavior = getExtensionBehavior();
-    for (TExtensionBehavior::const_iterator iter = extBehavior.begin();
-         iter != extBehavior.end(); ++iter) {
+    const TExtensionBehavior& extensionBehavior = getExtensionBehavior();
+    for (TExtensionBehavior::const_iterator iter = extensionBehavior.begin();
+         iter != extensionBehavior.end(); ++iter) {
         if (iter->second != EBhUndefined) {
             if (getResources().NV_shader_framebuffer_fetch && iter->first == "GL_EXT_shader_framebuffer_fetch") {
                 sink << "#extension GL_NV_shader_framebuffer_fetch : "
diff --git a/src/compiler/translator/TranslatorGLSL.cpp b/src/compiler/translator/TranslatorGLSL.cpp
index 83c0a69..1c243b7 100644
--- a/src/compiler/translator/TranslatorGLSL.cpp
+++ b/src/compiler/translator/TranslatorGLSL.cpp
@@ -64,9 +64,9 @@
 
 void TranslatorGLSL::writeExtensionBehavior() {
     TInfoSinkBase& sink = getInfoSink().obj;
-    const TExtensionBehavior& extBehavior = getExtensionBehavior();
-    for (TExtensionBehavior::const_iterator iter = extBehavior.begin();
-         iter != extBehavior.end(); ++iter) {
+    const TExtensionBehavior& extensionBehavior = getExtensionBehavior();
+    for (TExtensionBehavior::const_iterator iter = extensionBehavior.begin();
+         iter != extensionBehavior.end(); ++iter) {
         if (iter->second == EBhUndefined)
             continue;
 
diff --git a/src/compiler/translator/Types.cpp b/src/compiler/translator/Types.cpp
index 0fe6acc..d36936f 100644
--- a/src/compiler/translator/Types.cpp
+++ b/src/compiler/translator/Types.cpp
@@ -178,12 +178,11 @@
 
     if (isArray())
     {
-        // TODO: getArraySize() returns an int, not a size_t
-        size_t currentArraySize = getArraySize();
-        if (currentArraySize > INT_MAX / totalSize)
+        size_t arraySize = getArraySize();
+        if (arraySize > INT_MAX / totalSize)
             totalSize = INT_MAX;
         else
-            totalSize *= currentArraySize;
+            totalSize *= arraySize;
     }
 
     return totalSize;