diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2017-03-27 04:37:42 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-27 04:37:42 +0800 |
commit | 581630e0a71cffeadd4887a757889d6a3502275c (patch) | |
tree | 30f82068f8d462c7cea3959631274e6a39e608c7 /test/compress | |
parent | f5952933a00bac8c9d794d5b0e3d5f8d6173c4a9 (diff) | |
download | tracifyjs-581630e0a71cffeadd4887a757889d6a3502275c.tar.gz tracifyjs-581630e0a71cffeadd4887a757889d6a3502275c.zip |
fix typeof side effects (#1696)
`statement_to_expression()` drops `typeof` even if it operates on undeclared variables.
Since we now have `drop_side_effect_free()`, replace and remove this deprecated functionality.
Diffstat (limited to 'test/compress')
-rw-r--r-- | test/compress/negate-iife.js | 9 | ||||
-rw-r--r-- | test/compress/switch.js | 14 |
2 files changed, 19 insertions, 4 deletions
diff --git a/test/compress/negate-iife.js b/test/compress/negate-iife.js index e9ad37db..343e8e16 100644 --- a/test/compress/negate-iife.js +++ b/test/compress/negate-iife.js @@ -353,8 +353,9 @@ issue_1254_negate_iife_nested: { issue_1288: { options = { - negate_iife: true, conditionals: true, + negate_iife: true, + side_effects: false, }; input: { if (w) ; @@ -374,11 +375,11 @@ issue_1288: { })(0); } expect: { - w || function f() {}(); - x || function() { + w || !function f() {}(); + x || !function() { x = {}; }(); - y ? function() {}() : function(z) { + y ? !function() {}() : !function(z) { return z; }(0); } diff --git a/test/compress/switch.js b/test/compress/switch.js index 654a838b..c3e76302 100644 --- a/test/compress/switch.js +++ b/test/compress/switch.js @@ -579,3 +579,17 @@ issue_1690_2: { } expect_stdout: "PASS" } + +if_switch_typeof: { + options = { + conditionals: true, + dead_code: true, + side_effects: true, + } + input: { + if (a) switch(typeof b) {} + } + expect: { + a; + } +} |