Unify looking for symbols with a specific name in the AST
Keep only one traverser for looking up symbol nodes by name instead
of having two largely identical ones.
BUG=angleproject:2267
TEST=angle_unittests
Change-Id: I36e906258180e22b7b1353cab79d90266d99fa0e
Reviewed-on: https://chromium-review.googlesource.com/836895
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/OutputHLSL.cpp b/src/compiler/translator/OutputHLSL.cpp
index 571b018..f4342b4 100644
--- a/src/compiler/translator/OutputHLSL.cpp
+++ b/src/compiler/translator/OutputHLSL.cpp
@@ -15,11 +15,11 @@
#include "common/utilities.h"
#include "compiler/translator/BuiltInFunctionEmulator.h"
#include "compiler/translator/BuiltInFunctionEmulatorHLSL.h"
+#include "compiler/translator/FindSymbolNode.h"
#include "compiler/translator/ImageFunctionHLSL.h"
#include "compiler/translator/InfoSink.h"
#include "compiler/translator/NodeSearch.h"
#include "compiler/translator/RemoveSwitchFallThrough.h"
-#include "compiler/translator/SearchSymbol.h"
#include "compiler/translator/StructureHLSL.h"
#include "compiler/translator/TextureFunctionHLSL.h"
#include "compiler/translator/TranslatorHLSL.h"
@@ -2795,10 +2795,9 @@
TIntermSymbol *symbolNode,
TIntermTyped *expression)
{
- sh::SearchSymbol searchSymbol(symbolNode->getSymbol());
- expression->traverse(&searchSymbol);
+ const TIntermSymbol *symbolInInitializer = FindSymbolNode(expression, symbolNode->getSymbol());
- if (searchSymbol.foundMatch())
+ if (symbolInInitializer)
{
// Type already printed
out << "t" + str(mUniqueIndex) + " = ";