diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2019-04-24 02:50:15 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-24 02:50:15 +0800 |
commit | a84beafd1bbdb61ea5fc3662e349f6c960f1ba66 (patch) | |
tree | c2a54c6277c58459b5d760f3b801c9e4d11fb844 /test | |
parent | f01cc1e413990a2da37716fbe8627d651f489fff (diff) | |
download | tracifyjs-a84beafd1bbdb61ea5fc3662e349f6c960f1ba66.tar.gz tracifyjs-a84beafd1bbdb61ea5fc3662e349f6c960f1ba66.zip |
fix corner case in `assignments` (#3376)
fixes #3375
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/assignment.js | 22 | ||||
-rw-r--r-- | test/compress/drop-unused.js | 21 |
2 files changed, 43 insertions, 0 deletions
diff --git a/test/compress/assignment.js b/test/compress/assignment.js index ba412583..ece0185d 100644 --- a/test/compress/assignment.js +++ b/test/compress/assignment.js @@ -289,3 +289,25 @@ increment_decrement_2: { } expect_stdout: "42" } + +issue_3375: { + options = { + assignments: true, + reduce_vars: true, + } + input: { + console.log(typeof function(b) { + var a = b += 1; + --b; + return a; + }("object")); + } + expect: { + console.log(typeof function(b) { + var a = b += 1; + --b; + return a; + }("object")); + } + expect_stdout: "string" +} diff --git a/test/compress/drop-unused.js b/test/compress/drop-unused.js index b75c3ac5..74fe3693 100644 --- a/test/compress/drop-unused.js +++ b/test/compress/drop-unused.js @@ -2005,3 +2005,24 @@ issue_3233: { } expect_stdout: "PASS" } + +issue_3375: { + options = { + reduce_vars: true, + toplevel: true, + unused: true, + } + input: { + var b = 1; + var a = c = [], c = --b + ("function" == typeof f && f()); + var a = c && c[a]; + console.log(a, b); + } + expect: { + var b = 1; + var a = [], c = --b + ("function" == typeof f && f()); + a = c && c[a]; + console.log(a, b); + } + expect_stdout: "0 0" +} |