blob: fb7a6cdb9ba7e120ca2102c0c9b134e920b4f3d8 [file] [log] [blame]
daniel@transgaming.combdfb2e52010-11-15 16:41:20 +00001//
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
Geoff Lang17732822013-08-29 13:46:49 -04009#include "compiler/translator/SearchSymbol.h"
daniel@transgaming.combdfb2e52010-11-15 16:41:20 +000010
Geoff Lang17732822013-08-29 13:46:49 -040011#include "compiler/translator/InfoSink.h"
daniel@transgaming.combdfb2e52010-11-15 16:41:20 +000012
13namespace sh
14{
15SearchSymbol::SearchSymbol(const TString &symbol) : mSymbol(symbol)
16{
17 match = false;
18}
19
20void SearchSymbol::traverse(TIntermNode *node)
21{
22 node->traverse(this);
23}
24
25void SearchSymbol::visitSymbol(TIntermSymbol *symbolNode)
26{
27 if (symbolNode->getSymbol() == mSymbol)
28 {
29 match = true;
30 }
31}
32
33bool SearchSymbol::foundMatch() const
34{
35 return match;
36}
37}