Clean up ValidateMaxParameters

It doesn't need to use a traverser, since all function definitions can
be found simply by iterating over the children of the root node.

BUG=angleproject:2040
TEST=angle_unittests

Change-Id: I18a98eff9710485c0cdce73e7fffe124f7d7afb2
Reviewed-on: https://chromium-review.googlesource.com/508791
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/ValidateMaxParameters.cpp b/src/compiler/translator/ValidateMaxParameters.cpp
index 2d0b3eb..9dccbf4 100644
--- a/src/compiler/translator/ValidateMaxParameters.cpp
+++ b/src/compiler/translator/ValidateMaxParameters.cpp
@@ -7,34 +7,23 @@
 
 #include "compiler/translator/ValidateMaxParameters.h"
 
+#include "compiler/translator/IntermNode.h"
+
 namespace sh
 {
 
-ValidateMaxParameters::ValidateMaxParameters(unsigned int maxParameters)
-    : TIntermTraverser(true, false, false), mMaxParameters(maxParameters), mValid(true)
+bool ValidateMaxParameters(TIntermBlock *root, unsigned int maxParameters)
 {
-}
-
-bool ValidateMaxParameters::visitFunctionDefinition(Visit visit, TIntermFunctionDefinition *node)
-{
-    if (!mValid)
+    for (TIntermNode *node : *root->getSequence())
     {
-        return false;
+        TIntermFunctionDefinition *definition = node->getAsFunctionDefinition();
+        if (definition != nullptr &&
+            definition->getFunctionPrototype()->getSequence()->size() > maxParameters)
+        {
+            return false;
+        }
     }
-
-    if (node->getFunctionPrototype()->getSequence()->size() > mMaxParameters)
-    {
-        mValid = false;
-    }
-
-    return mValid;
-}
-
-bool ValidateMaxParameters::validate(TIntermNode *root, unsigned int maxParameters)
-{
-    ValidateMaxParameters argsTraverser(maxParameters);
-    root->traverse(&argsTraverser);
-    return argsTraverser.mValid;
+    return true;
 }
 
 }  // namespace sh