diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2021-01-05 16:15:12 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-06 00:15:12 +0800 |
commit | 7ebfb22d16a314404e1255aee9a470e1dd7b0af4 (patch) | |
tree | 65c5c3baf20e7ea5cc6a09a6f8eb276a8b8b2c9b /test | |
parent | 6eceac096694cfa3390e7112c4764a235592751d (diff) | |
download | tracifyjs-7ebfb22d16a314404e1255aee9a470e1dd7b0af4.tar.gz tracifyjs-7ebfb22d16a314404e1255aee9a470e1dd7b0af4.zip |
fix corner cases in `inline` & `unused` (#4509)
fixes #4508
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/destructured.js | 28 | ||||
-rw-r--r-- | test/compress/drop-unused.js | 15 |
2 files changed, 36 insertions, 7 deletions
diff --git a/test/compress/destructured.js b/test/compress/destructured.js index f9d32ce0..a476705d 100644 --- a/test/compress/destructured.js +++ b/test/compress/destructured.js @@ -2356,3 +2356,31 @@ issue_4504: { expect_stdout: "PASS" node_version: ">=6" } + +issue_4508: { + options = { + inline: true, + toplevel: true, + unused: true, + } + input: { + for (var i = 0; i < 2; i++) + (function f([ a ]) { + var a = console.log(a) && b, b = null; + })([ "PASS" ]); + } + expect: { + for (var i = 0; i < 2; i++) + [ [ a ] ] = [ [ "PASS" ] ], + b = void 0, + a = console.log(a) && b, + b = null, + void 0; + var a, b; + } + expect_stdout: [ + "PASS", + "PASS", + ] + node_version: ">=6" +} diff --git a/test/compress/drop-unused.js b/test/compress/drop-unused.js index ae1a6e5b..bb47682c 100644 --- a/test/compress/drop-unused.js +++ b/test/compress/drop-unused.js @@ -2669,8 +2669,7 @@ issue_3956: { })(); } expect: { - var c, d; - c += 0, + var d; console.log(NaN), d = 1 ^ console.log(1), console.log(d); @@ -2703,13 +2702,13 @@ issue_3962_1: { } expect: { var a = 0; - a = (function(c) { + (function(c) { do { console; 0..toString(); } while (0); if (c) console.log("PASS"); - }(1), 0); + })(1); void 0; } expect_stdout: "PASS" @@ -2736,13 +2735,13 @@ issue_3962_2: { } expect: { var a = 0; - a = (function(c) { + (function(c) { do { console; 0..toString(); } while (0); if (c) console.log("PASS"); - }(1), 0); + })(1); } expect_stdout: "PASS" } @@ -2799,7 +2798,9 @@ issue_4017: { var a = 0; console.log(function() { c &= 0; - var c = (a++, A = a, 0); + var c; + a++, + A = a; }()); } expect_stdout: "undefined" |