aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMihai Bazon <mihai@bazon.net>2013-11-08 11:57:17 +0200
committerMihai Bazon <mihai@bazon.net>2013-11-08 11:57:17 +0200
commit7d11b96f48f7f03727fa664d540484f214cadca2 (patch)
tree4a137f8e51f9845950395e2cddfc962f0610c5d2
parenteab99a1c3d229f7e73b91b5a28e5ebf53a24671b (diff)
downloadtracifyjs-7d11b96f48f7f03727fa664d540484f214cadca2.tar.gz
tracifyjs-7d11b96f48f7f03727fa664d540484f214cadca2.zip
Only descend twice after drop_unused if it's the same node type.
Fix #345
-rw-r--r--lib/compress.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/compress.js b/lib/compress.js
index f44277cd..c60ee19e 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -85,13 +85,14 @@ merge(Compressor.prototype, {
},
before: function(node, descend, in_list) {
if (node._squeezed) return node;
+ var was_scope = false;
if (node instanceof AST_Scope) {
- //node.drop_unused(this);
node = node.hoist_declarations(this);
+ was_scope = true;
}
descend(node, this);
node = node.optimize(this);
- if (node instanceof AST_Scope) {
+ if (was_scope && node instanceof AST_Scope) {
node.drop_unused(this);
descend(node, this);
}