From 131fb219a551d2afe69da3f9bda113677c64cb4c Mon Sep 17 00:00:00 2001 From: alexlamsl Date: Sun, 5 Nov 2017 20:04:35 +0800 Subject: [PATCH] remove obsolete `.scope` workaround --- lib/compress.js | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/lib/compress.js b/lib/compress.js index e135acaf..ba7c10f4 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -3530,6 +3530,7 @@ merge(Compressor.prototype, { && !exp.uses_arguments && !exp.uses_eval && exp.body.length == 1 + && !exp.contains_this() && all(exp.argnames, function(arg) { return arg.__unused; }) @@ -3543,23 +3544,6 @@ merge(Compressor.prototype, { expression: stat.body }); } - if (value) { - var tw = new TreeWalker(function(node) { - if (!value) return true; - if (node instanceof AST_SymbolRef) { - var ref = node.scope.find_variable(node); - if (ref && ref.scope.parent_scope === fn.parent_scope) { - value = null; - return true; - } - } - if (node instanceof AST_This && !tw.find_parent(AST_Scope)) { - value = null; - return true; - } - }); - value.walk(tw); - } if (value) { var args = self.args.concat(value); return make_sequence(self, args).optimize(compressor);