Separate function info from TIntermAggregate

This change will make it easier to split types of TIntermAggregate
nodes representing functions and function calls into different node
classes.

BUG=angleproject:1490
TEST=angle_unittests

Change-Id: I730aa7858fe31fda86218fc685980c6ad486f5e0
Reviewed-on: https://chromium-review.googlesource.com/394706
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/CallDAG.cpp b/src/compiler/translator/CallDAG.cpp
index 1c603ef..cb9d9cf 100644
--- a/src/compiler/translator/CallDAG.cpp
+++ b/src/compiler/translator/CallDAG.cpp
@@ -76,7 +76,8 @@
                 record.callees.push_back(static_cast<int>(callee->index));
             }
 
-            (*idToIndex)[data.node->getFunctionId()] = static_cast<int>(data.index);
+            (*idToIndex)[data.node->getFunctionSymbolInfo()->getId()] =
+                static_cast<int>(data.index);
         }
     }
 
@@ -109,8 +110,8 @@
             if (visit == PreVisit)
             {
                 // Function declaration, create an empty record.
-                auto& record = mFunctions[node->getName()];
-                record.name = node->getName();
+                auto &record = mFunctions[node->getFunctionSymbolInfo()->getName()];
+                record.name  = node->getFunctionSymbolInfo()->getName();
             }
             break;
           case EOpFunction:
@@ -118,11 +119,11 @@
                 // Function definition, create the record if need be and remember the node.
                 if (visit == PreVisit)
                 {
-                    auto it = mFunctions.find(node->getName());
+                    auto it = mFunctions.find(node->getFunctionSymbolInfo()->getName());
 
                     if (it == mFunctions.end())
                     {
-                        mCurrentFunction = &mFunctions[node->getName()];
+                        mCurrentFunction = &mFunctions[node->getFunctionSymbolInfo()->getName()];
                     }
                     else
                     {
@@ -130,8 +131,7 @@
                     }
 
                     mCurrentFunction->node = node;
-                    mCurrentFunction->name = node->getName();
-
+                    mCurrentFunction->name = node->getFunctionSymbolInfo()->getName();
                 }
                 else if (visit == PostVisit)
                 {
@@ -147,7 +147,7 @@
                     // Do not handle calls to builtin functions
                     if (node->isUserDefined())
                     {
-                        auto it = mFunctions.find(node->getName());
+                        auto it = mFunctions.find(node->getFunctionSymbolInfo()->getName());
                         ASSERT(it != mFunctions.end());
 
                         // We might be in a top-level function call to set a global variable
@@ -283,13 +283,9 @@
 
 const size_t CallDAG::InvalidIndex = std::numeric_limits<size_t>::max();
 
-size_t CallDAG::findIndex(const TIntermAggregate *function) const
+size_t CallDAG::findIndex(const TFunctionSymbolInfo *functionInfo) const
 {
-    TOperator op = function->getOp();
-    ASSERT(op == EOpPrototype || op == EOpFunction || op == EOpFunctionCall);
-    UNUSED_ASSERTION_VARIABLE(op);
-
-    auto it = mFunctionIdToIndex.find(function->getFunctionId());
+    auto it = mFunctionIdToIndex.find(functionInfo->getId());
 
     if (it == mFunctionIdToIndex.end())
     {
@@ -309,7 +305,7 @@
 
 const CallDAG::Record &CallDAG::getRecord(const TIntermAggregate *function) const
 {
-    size_t index = findIndex(function);
+    size_t index = findIndex(function->getFunctionSymbolInfo());
     ASSERT(index != InvalidIndex && index < mRecords.size());
     return mRecords[index];
 }