From d68ddc31f94074e09c661cb79ea43cef9adb44e6 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Wed, 4 Dec 2019 20:24:55 +0800 Subject: fix corner case in `reduce_vars` (#3623) fixes #3622 --- lib/compress.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/compress.js b/lib/compress.js index e18fd575..4442bbb5 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -701,8 +701,11 @@ merge(Compressor.prototype, { node.argnames.forEach(function(arg, i) { var d = arg.definition(); if (d.fixed === undefined && (!node.uses_arguments || tw.has_directive("use strict"))) { + var value = iife.args[i]; d.fixed = function() { - return iife.args[i] || make_node(AST_Undefined, iife); + var j = node.argnames.indexOf(arg); + if (j < 0) return value; + return iife.args[j] || make_node(AST_Undefined, iife); }; tw.loop_ids[d.id] = tw.in_loop; mark(tw, d, true); -- cgit v1.2.3