diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2017-07-15 15:16:11 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-15 15:16:11 +0800 |
commit | a5ffe2c23fdfaf13f3466a01d9dd9d590c5e8672 (patch) | |
tree | 1c208aca7fc34b06470755bb9127da40b91347c7 /test/compress | |
parent | 9282e7b0c6f20bc95ba3d2bab2bbaccebab03c9a (diff) | |
download | tracifyjs-a5ffe2c23fdfaf13f3466a01d9dd9d590c5e8672.tar.gz tracifyjs-a5ffe2c23fdfaf13f3466a01d9dd9d590c5e8672.zip |
drop `unused` builtin globals under `unsafe` (#2236)
fixes #2233
Diffstat (limited to 'test/compress')
-rw-r--r-- | test/compress/dead-code.js | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/test/compress/dead-code.js b/test/compress/dead-code.js index 0fcbbe43..abf5297c 100644 --- a/test/compress/dead-code.js +++ b/test/compress/dead-code.js @@ -230,3 +230,82 @@ accessor: { } expect: {} } + +issue_2233_1: { + options = { + pure_getters: "strict", + side_effects: true, + unsafe: true, + } + input: { + Array.isArray; + Boolean; + console.log; + Error.name; + Function.length; + Math.random; + Number.isNaN; + RegExp; + Object.defineProperty; + String.fromCharCode; + } + expect: {} + expect_stdout: true +} + +issue_2233_2: { + options = { + pure_getters: "strict", + reduce_vars: true, + side_effects: true, + unsafe: true, + unused: true, + } + input: { + var RegExp; + Array.isArray; + RegExp; + UndeclaredGlobal; + function foo() { + var Number; + AnotherUndeclaredGlobal; + Math.sin; + Number.isNaN; + } + } + expect: { + var RegExp; + UndeclaredGlobal; + function foo() { + var Number; + AnotherUndeclaredGlobal; + Number.isNaN; + } + } +} + +issue_2233_3: { + options = { + pure_getters: "strict", + reduce_vars: true, + side_effects: true, + toplevel: true, + unsafe: true, + unused: true, + } + input: { + var RegExp; + Array.isArray; + RegExp; + UndeclaredGlobal; + function foo() { + var Number; + AnotherUndeclaredGlobal; + Math.sin; + Number.isNaN; + } + } + expect: { + UndeclaredGlobal; + } +} |