Line data Source code
1 : //
2 : // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
3 : // Use of this source code is governed by a BSD-style license that can be
4 : // found in the LICENSE file.
5 : //
6 : // SearchSymbol is an AST traverser to detect the use of a given symbol name
7 : //
8 :
9 : #include "compiler/translator/SearchSymbol.h"
10 :
11 : #include "compiler/translator/InfoSink.h"
12 :
13 : namespace sh
14 : {
15 0 : SearchSymbol::SearchSymbol(const TString &symbol)
16 : : TIntermTraverser(true, false, false),
17 0 : mSymbol(symbol)
18 : {
19 0 : match = false;
20 0 : }
21 :
22 0 : void SearchSymbol::traverse(TIntermNode *node)
23 : {
24 0 : node->traverse(this);
25 0 : }
26 :
27 0 : void SearchSymbol::visitSymbol(TIntermSymbol *symbolNode)
28 : {
29 0 : if (symbolNode->getSymbol() == mSymbol)
30 : {
31 0 : match = true;
32 : }
33 0 : }
34 :
35 0 : bool SearchSymbol::foundMatch() const
36 : {
37 0 : return match;
38 : }
39 : }
|