blob: 9968262718851e57a5d04e521539cbe5ffb47a01 [file] [log] [blame]
zmo@google.comfd747b82011-04-23 01:30:07 +00001//
2// Copyright (c) 2002-2011 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
7#include "compiler/MapLongVariableNames.h"
8
9namespace {
10
11TString mapLongName(int id, const TString& name)
12{
13 ASSERT(name.size() > MAX_IDENTIFIER_NAME_SIZE);
14 TStringStream stream;
15 stream << "webgl_" << id << "_";
16 stream << name.substr(0, MAX_IDENTIFIER_NAME_SIZE - stream.str().size());
17 return stream.str();
18}
19
20} // anonymous namespace
21
22void MapLongVariableNames::visitSymbol(TIntermSymbol* symbol)
23{
24 ASSERT(symbol != NULL);
25 if (symbol->getSymbol().size() > MAX_IDENTIFIER_NAME_SIZE)
26 symbol->setSymbol(mapLongName(symbol->getId(), symbol->getSymbol()));
27}
28
29void MapLongVariableNames::visitConstantUnion(TIntermConstantUnion*)
30{
31}
32
33bool MapLongVariableNames::visitBinary(Visit, TIntermBinary*)
34{
35 return true;
36}
37
38bool MapLongVariableNames::visitUnary(Visit, TIntermUnary*)
39{
40 return true;
41}
42
43bool MapLongVariableNames::visitSelection(Visit, TIntermSelection*)
44{
45 return true;
46}
47
48bool MapLongVariableNames::visitAggregate(Visit, TIntermAggregate* node)
49{
50 return true;
51}
52
53bool MapLongVariableNames::visitLoop(Visit, TIntermLoop*)
54{
55 return true;
56}
57
58bool MapLongVariableNames::visitBranch(Visit, TIntermBranch*)
59{
60 return true;
61}