From 87cf7152135281a4b1a1163b26ea918a0a264f0b Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Sat, 19 Dec 2020 21:47:01 +0000 Subject: fix corner case with destructuring `catch` (#4421) fixes #4420 --- test/compress/destructured.js | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'test/compress/destructured.js') diff --git a/test/compress/destructured.js b/test/compress/destructured.js index 4c36e451..06c9fddb 100644 --- a/test/compress/destructured.js +++ b/test/compress/destructured.js @@ -1968,3 +1968,36 @@ issue_4399: { expect_stdout: "PASS" node_version: ">=6" } + +issue_4420: { + options = { + unused: true, + } + input: { + console.log(function() { + var a = 1; + try { + throw [ "FAIL", "PASS" ]; + } catch ({ + [a]: b, + }) { + let a = 0; + return b; + } + }()); + } + expect: { + console.log(function() { + var a = 1; + try { + throw [ "FAIL", "PASS" ]; + } catch ({ + [a]: b, + }) { + return b; + } + }()); + } + expect_stdout: "PASS" + node_version: ">=8" +} -- cgit v1.2.3