Fix a traverse bug.
In loop node, the init part was skipped in traversing.
BUG=
TEST=
R=kbr@chromium.org
Review URL: https://codereview.appspot.com/14366043
diff --git a/src/compiler/IntermTraverse.cpp b/src/compiler/IntermTraverse.cpp
index 32f8384..ccc1ac5 100644
--- a/src/compiler/IntermTraverse.cpp
+++ b/src/compiler/IntermTraverse.cpp
@@ -211,9 +211,15 @@
if (cond)
cond->traverse(it);
+
+ if (init)
+ init->traverse(it);
}
else
{
+ if (init)
+ init->traverse(it);
+
if (cond)
cond->traverse(it);
diff --git a/src/compiler/MapLongVariableNames.cpp b/src/compiler/MapLongVariableNames.cpp
index a41d20f..077ef5d 100644
--- a/src/compiler/MapLongVariableNames.cpp
+++ b/src/compiler/MapLongVariableNames.cpp
@@ -102,13 +102,6 @@
}
}
-bool MapLongVariableNames::visitLoop(Visit, TIntermLoop* node)
-{
- if (node->getInit())
- node->getInit()->traverse(this);
- return true;
-}
-
TString MapLongVariableNames::mapGlobalLongName(const TString& name)
{
ASSERT(mGlobalMap);
diff --git a/src/compiler/MapLongVariableNames.h b/src/compiler/MapLongVariableNames.h
index d6352ac..fd2ff82 100644
--- a/src/compiler/MapLongVariableNames.h
+++ b/src/compiler/MapLongVariableNames.h
@@ -48,7 +48,6 @@
MapLongVariableNames(LongNameMap* globalMap);
virtual void visitSymbol(TIntermSymbol*);
- virtual bool visitLoop(Visit, TIntermLoop*);
private:
TString mapGlobalLongName(const TString& name);