From 2415a72e755c7685c677c2edf0c1e91fbed54e2e Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Fri, 18 Dec 2020 15:45:41 +0000 Subject: fix corner case in `unused` (#4405) fixes #4404 --- lib/compress.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/compress.js b/lib/compress.js index a3842bed..1249e620 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -5860,7 +5860,15 @@ merge(Compressor.prototype, { if (def.scope === self) assignments.add(def.id, node); } var node_def, props = [], sym = assign_as_unused(node, props); - if (sym && self.variables.get(sym.name) === (node_def = sym.definition())) { + if (sym && self.variables.get(sym.name) === (node_def = sym.definition()) + && !(is_arguments(node_def) && !all(self.argnames, function(argname) { + return !argname.match_symbol(function(node) { + if (node instanceof AST_SymbolFunarg) { + var def = node.definition(); + return def.references.length > def.replaced; + } + }, true); + }))) { props.forEach(function(prop) { prop.walk(tw); }); -- cgit v1.2.3