From 3c384cf9a8ed4230cf87f14ab017b613b38df628 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Sun, 6 Dec 2020 10:30:50 +0000 Subject: fix corner case in `collapse_vars` (#4332) fixes #4331 --- test/compress/spread.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'test/compress') diff --git a/test/compress/spread.js b/test/compress/spread.js index 01818dc3..21ccbe6d 100644 --- a/test/compress/spread.js +++ b/test/compress/spread.js @@ -399,3 +399,29 @@ issue_4329: { expect_stdout: "PASS" node_version: ">=8" } + +issue_4331: { + options = { + collapse_vars: true, + toplevel: true, + } + input: { + var a = "PASS", b; + console, + b = a; + (function() { + a++; + })(...a); + console.log(b); + } + expect: { + var a = "PASS", b; + console; + (function() { + a++; + })(...b = a); + console.log(b); + } + expect_stdout: "PASS" + node_version: ">=8" +} -- cgit v1.2.3