diff options
Diffstat (limited to 'gfx/angle/src/compiler/translator/SearchSymbol.cpp')
-rwxr-xr-x | gfx/angle/src/compiler/translator/SearchSymbol.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/gfx/angle/src/compiler/translator/SearchSymbol.cpp b/gfx/angle/src/compiler/translator/SearchSymbol.cpp new file mode 100755 index 000000000..cccd4d3ff --- /dev/null +++ b/gfx/angle/src/compiler/translator/SearchSymbol.cpp @@ -0,0 +1,39 @@ +// +// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// SearchSymbol is an AST traverser to detect the use of a given symbol name +// + +#include "compiler/translator/SearchSymbol.h" + +#include "compiler/translator/InfoSink.h" + +namespace sh +{ +SearchSymbol::SearchSymbol(const TString &symbol) + : TIntermTraverser(true, false, false), + mSymbol(symbol) +{ + match = false; +} + +void SearchSymbol::traverse(TIntermNode *node) +{ + node->traverse(this); +} + +void SearchSymbol::visitSymbol(TIntermSymbol *symbolNode) +{ + if (symbolNode->getSymbol() == mSymbol) + { + match = true; + } +} + +bool SearchSymbol::foundMatch() const +{ + return match; +} +} |