From 111366fca0352df45459ee8dc3fa6d8dcc337d92 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Mon, 21 Jun 2021 04:12:45 +0100 Subject: fix corner case in `collapse_vars` (#5018) fixes #5017 --- test/compress/destructured.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'test/compress/destructured.js') diff --git a/test/compress/destructured.js b/test/compress/destructured.js index 41e337be..140d48e1 100644 --- a/test/compress/destructured.js +++ b/test/compress/destructured.js @@ -2625,3 +2625,25 @@ issue_4994: { expect_stdout: "PASS" node_version: ">=6" } + +issue_5017: { + options = { + collapse_vars: true, + reduce_vars: true, + toplevel: true, + } + input: { + var a = function() {}; + var b = c = a; + var c = [ c ] = [ c ]; + console.log(c[0] === a ? "PASS" : "FAIL"); + } + expect: { + var a = function() {}; + var b = a; + var c = [ c ] = [ c = a ]; + console.log(c[0] === a ? "PASS" : "FAIL"); + } + expect_stdout: "PASS" + node_version: ">=6" +} -- cgit v1.2.3