diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-12-19 12:28:38 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-19 12:28:38 +0800 |
commit | e6dd471f8fff84c878153008139150a090c5ba19 (patch) | |
tree | ec207ca4b7416a79b9abba17fdda35b44e5ef743 /test/compress | |
parent | 0f55bd92f18bd27628f1cfd10c9fb5d70f4d4d29 (diff) | |
download | tracifyjs-e6dd471f8fff84c878153008139150a090c5ba19.tar.gz tracifyjs-e6dd471f8fff84c878153008139150a090c5ba19.zip |
support destructuring of `catch` variable (#4412)
Diffstat (limited to 'test/compress')
-rw-r--r-- | test/compress/destructured.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/test/compress/destructured.js b/test/compress/destructured.js index 8e1cf68c..4c36e451 100644 --- a/test/compress/destructured.js +++ b/test/compress/destructured.js @@ -750,6 +750,46 @@ simple_var: { node_version: ">=6" } +drop_catch: { + options = { + dead_code: true, + } + input: { + try {} catch ({ + [console.log("FAIL")]: e, + }) {} finally { + console.log("PASS"); + } + } + expect: { + console.log("PASS"); + } + expect_stdout: "PASS" + node_version: ">=6" +} + +drop_catch_var: { + options = { + unused: true, + } + input: { + try { + throw new Error("PASS"); + } catch ({ name, message }) { + console.log(message); + } + } + expect: { + try { + throw new Error("PASS"); + } catch ({ message }) { + console.log(message); + } + } + expect_stdout: "PASS" + node_version: ">=6" +} + collapse_vars_1: { options = { collapse_vars: true, |