Split TIntermFunctionPrototype from TIntermAggregate
Function prototypes now have their own class TIntermFunctionPrototype.
It's only used for prototypes, not function parameter lists.
TIntermAggregate is still used for parameter lists and function calls.
BUGS=angleproject:1490
TEST=angle_unittests
Change-Id: I6e246ad00a29c2335bd2ab7f61cf73fe463b74bb
Reviewed-on: https://chromium-review.googlesource.com/427944
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/IntermTraverse.cpp b/src/compiler/translator/IntermTraverse.cpp
index ab3ad15..2ccf5aa 100644
--- a/src/compiler/translator/IntermTraverse.cpp
+++ b/src/compiler/translator/IntermTraverse.cpp
@@ -81,6 +81,11 @@
it->traverseDeclaration(this);
}
+void TIntermFunctionPrototype::traverse(TIntermTraverser *it)
+{
+ it->traverseFunctionPrototype(this);
+}
+
void TIntermAggregate::traverse(TIntermTraverser *it)
{
it->traverseAggregate(this);
@@ -559,6 +564,36 @@
visitDeclaration(PostVisit, node);
}
+void TIntermTraverser::traverseFunctionPrototype(TIntermFunctionPrototype *node)
+{
+ bool visit = true;
+
+ TIntermSequence *sequence = node->getSequence();
+
+ if (preVisit)
+ visit = visitFunctionPrototype(PreVisit, node);
+
+ if (visit)
+ {
+ incrementDepth(node);
+
+ for (auto *child : *sequence)
+ {
+ child->traverse(this);
+ if (visit && inVisit)
+ {
+ if (child != sequence->back())
+ visit = visitFunctionPrototype(InVisit, node);
+ }
+ }
+
+ decrementDepth();
+ }
+
+ if (visit && postVisit)
+ visitFunctionPrototype(PostVisit, node);
+}
+
// Traverse an aggregate node. Same comments in binary node apply here.
void TIntermTraverser::traverseAggregate(TIntermAggregate *node)
{
@@ -600,15 +635,19 @@
TIntermTraverser::traverseFunctionDefinition(node);
}
+void TLValueTrackingTraverser::traverseFunctionPrototype(TIntermFunctionPrototype *node)
+{
+ TIntermSequence *sequence = node->getSequence();
+ addToFunctionMap(node->getFunctionSymbolInfo()->getNameObj(), sequence);
+
+ TIntermTraverser::traverseFunctionPrototype(node);
+}
+
void TLValueTrackingTraverser::traverseAggregate(TIntermAggregate *node)
{
bool visit = true;
TIntermSequence *sequence = node->getSequence();
- if (node->getOp() == EOpPrototype)
- {
- addToFunctionMap(node->getFunctionSymbolInfo()->getNameObj(), sequence);
- }
if (preVisit)
visit = visitAggregate(PreVisit, node);