Only return symbol from TSymbolTable::find

Whether the symbol is built-in can be easily determined from the
SymbolType stored in the symbol, it doesn't need to be returned
separately. The sameScope value that could be returned from
TSymbolTable::find was never used, so that can be removed as well.

BUG=angleproject:2267
TEST=angle_unittests

Change-Id: I06958741ebec67d496f830a83b4f6f1359632f45
Reviewed-on: https://chromium-review.googlesource.com/891021
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/ParseContext.cpp b/src/compiler/translator/ParseContext.cpp
index 2d59a08..c7c4c77 100644
--- a/src/compiler/translator/ParseContext.cpp
+++ b/src/compiler/translator/ParseContext.cpp
@@ -5815,16 +5815,15 @@
     // 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.
-    bool builtIn;
-    const TSymbol *symbol = symbolTable.find(name, mShaderVersion, &builtIn);
+    const TSymbol *symbol = symbolTable.find(name, mShaderVersion);
     if (symbol != nullptr && !symbol->isFunction())
     {
         error(loc, "function name expected", name.c_str());
     }
     else
     {
-        symbol = symbolTable.find(TFunction::GetMangledNameFromCall(name, *arguments),
-                                  mShaderVersion, &builtIn);
+        symbol =
+            symbolTable.find(TFunction::GetMangledNameFromCall(name, *arguments), mShaderVersion);
         if (symbol == nullptr)
         {
             error(loc, "no matching overloaded function found", name.c_str());
@@ -5835,12 +5834,12 @@
             //
             // A declared function.
             //
-            if (builtIn && fnCandidate->extension() != TExtension::UNDEFINED)
+            if (fnCandidate->extension() != TExtension::UNDEFINED)
             {
                 checkCanUseExtension(loc, fnCandidate->extension());
             }
             TOperator op = fnCandidate->getBuiltInOp();
-            if (builtIn && op != EOpNull)
+            if (fnCandidate->symbolType() == SymbolType::BuiltIn && op != EOpNull)
             {
                 // A function call mapped to a built-in operation.
                 if (fnCandidate->getParamCount() == 1)
@@ -5867,14 +5866,13 @@
             }
             else
             {
-                // This is a real function call
+                // This is a real function call.
                 TIntermAggregate *callNode = nullptr;
 
-                // If builtIn == false, the function is user defined - could be an overloaded
-                // built-in as well.
-                // if builtIn == true, it's a builtIn function with no op associated with it.
-                // This needs to happen after the function info including name is set.
-                if (builtIn)
+                // If the symbol type is not BuiltIn, the function is user defined - could be an
+                // overloaded built-in as well. if the symbol type is BuiltIn, it's a built-in
+                // function with no op associated with it.
+                if (fnCandidate->symbolType() == SymbolType::BuiltIn)
                 {
                     callNode = TIntermAggregate::CreateBuiltInFunctionCall(*fnCandidate, arguments);
                     checkTextureOffsetConst(callNode);
diff --git a/src/compiler/translator/SymbolTable.cpp b/src/compiler/translator/SymbolTable.cpp
index 7548880..4bc29a4 100644
--- a/src/compiler/translator/SymbolTable.cpp
+++ b/src/compiler/translator/SymbolTable.cpp
@@ -139,10 +139,7 @@
     return firstDeclaration;
 }
 
-const TSymbol *TSymbolTable::find(const TString &name,
-                                  int shaderVersion,
-                                  bool *builtIn,
-                                  bool *sameScope) const
+const TSymbol *TSymbolTable::find(const TString &name, int shaderVersion) const
 {
     int level       = currentLevel();
     TSymbol *symbol = nullptr;
@@ -158,12 +155,8 @@
             level--;
 
         symbol = table[level]->find(name);
-    } while (symbol == nullptr && --level >= 0);
-
-    if (builtIn)
-        *builtIn = (level <= LAST_BUILTIN_LEVEL);
-    if (sameScope)
-        *sameScope = (level == currentLevel());
+        level--;
+    } while (symbol == nullptr && level >= 0);
 
     return symbol;
 }
diff --git a/src/compiler/translator/SymbolTable.h b/src/compiler/translator/SymbolTable.h
index 269fe43..9a5363e 100644
--- a/src/compiler/translator/SymbolTable.h
+++ b/src/compiler/translator/SymbolTable.h
@@ -188,10 +188,7 @@
     const TFunction *setUserDefinedFunctionParameterNamesFromDefinition(const TFunction *function,
                                                                         bool *wasDefinedOut);
 
-    const TSymbol *find(const TString &name,
-                        int shaderVersion,
-                        bool *builtIn   = nullptr,
-                        bool *sameScope = nullptr) const;
+    const TSymbol *find(const TString &name, int shaderVersion) const;
 
     const TSymbol *findGlobal(const TString &name) const;