From a1b2735dd8f7f89b7dd57ee7098f1720df28838f Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Fri, 25 Dec 2020 12:10:58 +0000 Subject: fix corner case in `unused` (#4457) fixes #4456 --- 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 7fe2f0c8..98e84f48 100644 --- a/test/compress/destructured.js +++ b/test/compress/destructured.js @@ -2164,3 +2164,36 @@ issue_4446: { expect_stdout: "PASS" node_version: ">=6" } + +issue_4456: { + options = { + pure_getters: true, + unused: true, + } + input: { + var o = { + set p(v) { + console.log(v); + }, + }; + [ function() { + try { + return o; + } catch ({}) {} + }().p ] = [ "PASS" ]; + } + expect: { + var o = { + set p(v) { + console.log(v); + }, + }; + [ function() { + try { + return o; + } catch ({}) {} + }().p ] = [ "PASS" ]; + } + expect_stdout: "PASS" + node_version: ">=6" +} -- cgit v1.2.3