From 0a1c9b34cea8bf740c70d5457ef9e3bd37778607 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Sat, 21 Mar 2020 00:55:24 +0800 Subject: fix corner case in `evaluate` & `ie8` (#3751) fixes #3750 --- lib/compress.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lib/compress.js') diff --git a/lib/compress.js b/lib/compress.js index 96229369..343994e7 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -3373,15 +3373,18 @@ merge(Compressor.prototype, { var args = eval_args(this.args); if (!args) return this; if (!stat.value) return undefined; - fn.argnames.forEach(function(sym, i) { + if (!all(fn.argnames, function(sym, i) { var value = args[i]; - sym.definition().references.forEach(function(node) { + var def = sym.definition(); + if (def.orig[def.orig.length - 1] !== sym) return false; + def.references.forEach(function(node) { node._eval = function() { return value; }; cached.push(node); }); - }); + return true; + })) return this; fn.evaluating = true; var val = stat.value._eval(compressor, ignore_side_effects, cached, depth); delete fn.evaluating; -- cgit v1.2.3