diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-11-19 00:34:55 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-19 08:34:55 +0800 |
commit | 134ef0b1eb5e7ec0fc02e3aa0f36e319b4b82ac4 (patch) | |
tree | b815d719af7dc5d56f5f5508f5b39778eb03c0fd /test | |
parent | db87dcf13e69cecd0f6153f65ab9aab81cffd574 (diff) | |
download | tracifyjs-134ef0b1eb5e7ec0fc02e3aa0f36e319b4b82ac4.tar.gz tracifyjs-134ef0b1eb5e7ec0fc02e3aa0f36e319b4b82ac4.zip |
fix corner case in `dead_code` (#4304)
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/const.js | 17 | ||||
-rw-r--r-- | test/compress/let.js | 20 |
2 files changed, 37 insertions, 0 deletions
diff --git a/test/compress/const.js b/test/compress/const.js index 0f5e3fdd..7e393d4f 100644 --- a/test/compress/const.js +++ b/test/compress/const.js @@ -57,6 +57,23 @@ retain_block: { expect_stdout: true } +retain_catch: { + options = { + dead_code: true, + } + input: { + try {} catch (a) { + const a = "aa"; + } + } + expect: { + try {} catch (a) { + const a = "aa"; + } + } + expect_stdout: true +} + if_dead_branch: { options = { conditionals: true, diff --git a/test/compress/let.js b/test/compress/let.js index 0476c431..0669b36f 100644 --- a/test/compress/let.js +++ b/test/compress/let.js @@ -20,6 +20,26 @@ retain_block: { node_version: ">=4" } +retain_catch: { + options = { + dead_code: true, + } + input: { + "use strict"; + try {} catch (a) { + let a = "aa"; + } + } + expect: { + "use strict"; + try {} catch (a) { + let a = "aa"; + } + } + expect_stdout: true + node_version: ">=4" +} + if_dead_branch: { options = { conditionals: true, |