Always store function headers in TIntermFunctionPrototype nodes

TIntermFunctionDefinition nodes now have a TIntermFunctionPrototype
child that stores the function signature, instead of having a separate
type and an aggregate child that stores the parameters.

This makes parsing functions simpler, and paves the way for further
simplifications of function parsing, like reducing conversions between
symbol table structures and AST structures.

TIntermAggregate is now only used for function calls.

BUG=angleproject:1490
TEST=angle_unittests, angle_end2end_tests

Change-Id: Ib56a77b5ef5123b142963a18499690bf37fed987
Reviewed-on: https://chromium-review.googlesource.com/427945
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/RemoveDynamicIndexing.cpp b/src/compiler/translator/RemoveDynamicIndexing.cpp
index d439235..41aaced 100644
--- a/src/compiler/translator/RemoveDynamicIndexing.cpp
+++ b/src/compiler/translator/RemoveDynamicIndexing.cpp
@@ -195,18 +195,28 @@
         numCases = type.getNominalSize();
     }
 
-    TIntermAggregate *paramsNode = new TIntermAggregate(EOpParameters);
+    TIntermFunctionPrototype *prototypeNode = nullptr;
+    if (write)
+    {
+        prototypeNode = new TIntermFunctionPrototype(TType(EbtVoid));
+    }
+    else
+    {
+        prototypeNode = new TIntermFunctionPrototype(fieldType);
+    }
+    prototypeNode->getFunctionSymbolInfo()->setNameObj(GetIndexFunctionName(type, write));
+
     TQualifier baseQualifier     = EvqInOut;
     if (!write)
         baseQualifier        = EvqIn;
     TIntermSymbol *baseParam = CreateBaseSymbol(type, baseQualifier);
-    paramsNode->getSequence()->push_back(baseParam);
+    prototypeNode->getSequence()->push_back(baseParam);
     TIntermSymbol *indexParam = CreateIndexSymbol();
-    paramsNode->getSequence()->push_back(indexParam);
+    prototypeNode->getSequence()->push_back(indexParam);
     if (write)
     {
         TIntermSymbol *valueParam = CreateValueSymbol(fieldType);
-        paramsNode->getSequence()->push_back(valueParam);
+        prototypeNode->getSequence()->push_back(valueParam);
     }
 
     TIntermBlock *statementList = new TIntermBlock();
@@ -276,16 +286,8 @@
     bodyNode->getSequence()->push_back(ifNode);
     bodyNode->getSequence()->push_back(useLastBlock);
 
-    TIntermFunctionDefinition *indexingFunction = nullptr;
-    if (write)
-    {
-        indexingFunction = new TIntermFunctionDefinition(TType(EbtVoid), paramsNode, bodyNode);
-    }
-    else
-    {
-        indexingFunction = new TIntermFunctionDefinition(fieldType, paramsNode, bodyNode);
-    }
-    indexingFunction->getFunctionSymbolInfo()->setNameObj(GetIndexFunctionName(type, write));
+    TIntermFunctionDefinition *indexingFunction =
+        new TIntermFunctionDefinition(prototypeNode, bodyNode);
     return indexingFunction;
 }