Split TIntermFunctionDefinition from TIntermAggregate

This makes the code easier to understand. Function definition nodes
always have just two children, the parameters node and the function
body node, so there was no proper reason why they should be aggregate
nodes.

As a part of this change, intermediate output is modified to print
symbol table ids of functions so that debugging function id related
functionality will be easier in the future.

After this patch, TIntermAggregate is still used for function
prototypes, function parameter lists, function calls, variable and
invariant declarations and the comma (sequence) operator.

BUG=angleproject:1490
TEST=angle_unittests, angle_end2end_tests

Change-Id: Ib88b4ca5d21abd5f126836ca5900d0baecabd19e
Reviewed-on: https://chromium-review.googlesource.com/394707
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/compiler/translator/CallDAG.cpp b/src/compiler/translator/CallDAG.cpp
index cb9d9cf..9810fa9 100644
--- a/src/compiler/translator/CallDAG.cpp
+++ b/src/compiler/translator/CallDAG.cpp
@@ -94,13 +94,39 @@
         }
 
         std::set<CreatorFunctionData*> callees;
-        TIntermAggregate *node;
+        TIntermFunctionDefinition *node;
         TString name;
         size_t index;
         bool indexAssigned;
         bool visiting;
     };
 
+    bool visitFunctionDefinition(Visit visit, TIntermFunctionDefinition *node) override
+    {
+        // Create the record if need be and remember the node.
+        if (visit == PreVisit)
+        {
+            auto it = mFunctions.find(node->getFunctionSymbolInfo()->getName());
+
+            if (it == mFunctions.end())
+            {
+                mCurrentFunction = &mFunctions[node->getFunctionSymbolInfo()->getName()];
+            }
+            else
+            {
+                mCurrentFunction = &it->second;
+            }
+
+            mCurrentFunction->node = node;
+            mCurrentFunction->name = node->getFunctionSymbolInfo()->getName();
+        }
+        else if (visit == PostVisit)
+        {
+            mCurrentFunction = nullptr;
+        }
+        return true;
+    }
+
     // Aggregates the AST node for each function as well as the name of the functions called by it
     bool visitAggregate(Visit visit, TIntermAggregate *node) override
     {
@@ -114,31 +140,6 @@
                 record.name  = node->getFunctionSymbolInfo()->getName();
             }
             break;
-          case EOpFunction:
-            {
-                // Function definition, create the record if need be and remember the node.
-                if (visit == PreVisit)
-                {
-                    auto it = mFunctions.find(node->getFunctionSymbolInfo()->getName());
-
-                    if (it == mFunctions.end())
-                    {
-                        mCurrentFunction = &mFunctions[node->getFunctionSymbolInfo()->getName()];
-                    }
-                    else
-                    {
-                        mCurrentFunction = &it->second;
-                    }
-
-                    mCurrentFunction->node = node;
-                    mCurrentFunction->name = node->getFunctionSymbolInfo()->getName();
-                }
-                else if (visit == PostVisit)
-                {
-                    mCurrentFunction = nullptr;
-                }
-                break;
-            }
           case EOpFunctionCall:
             {
                 // Function call, add the callees