aboutsummaryrefslogtreecommitdiff
path: root/tools/js-optimizer.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-05-10 17:29:00 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-05-10 17:33:23 -0700
commit32444e9c75d082c97c6ee7fbca2ca53982a54957 (patch)
treeed84a25f56c1abb5037391783acad55f266b7da1 /tools/js-optimizer.js
parent945c2fcf445e0cc1bf62c43383f902d3a7bdb04c (diff)
only recurse on decreasing uses on locals, and clear out names to avoid confusion later
Diffstat (limited to 'tools/js-optimizer.js')
-rw-r--r--tools/js-optimizer.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/tools/js-optimizer.js b/tools/js-optimizer.js
index 0bb61eae..2d0d51f9 100644
--- a/tools/js-optimizer.js
+++ b/tools/js-optimizer.js
@@ -1876,10 +1876,13 @@ function eliminate(ast, memSafe) {
traverse(value, function(node, type) {
if (type == 'name') {
var name = node[1];
- uses[name]--; // cannot be infinite recursion since we descend an energy function
- assert(uses[name] >= 0);
- unprocessVariable(name);
- processVariable(name);
+ node[1] = ''; // we can remove this - it will never be shown, and should not be left to confuse us as we traverse
+ if (name in locals) {
+ uses[name]--; // cannot be infinite recursion since we descend an energy function
+ assert(uses[name] >= 0);
+ unprocessVariable(name);
+ processVariable(name);
+ }
}
});
}