From: Mihai Bazon Date: Fri, 8 Nov 2013 09:57:17 +0000 (+0200) Subject: Only descend twice after drop_unused if it's the same node type. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=7d11b96f48f7f03727fa664d540484f214cadca2;p=UglifyJS.git Only descend twice after drop_unused if it's the same node type. Fix #345 --- 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); }