diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2021-07-06 19:23:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-07 02:23:09 +0800 |
commit | 1fefe3f1d138f2a1dd9386e02c58f60635632611 (patch) | |
tree | f3d8dc93563cf1b4864f55b1c8b43a950fbceaac /test | |
parent | 0668fad5e9000fc8d4857f033c3e90b1cedb4563 (diff) | |
download | tracifyjs-1fefe3f1d138f2a1dd9386e02c58f60635632611.tar.gz tracifyjs-1fefe3f1d138f2a1dd9386e02c58f60635632611.zip |
fix corner case in `reduce_vars` (#5056)
fixes #5055
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/reduce_vars.js | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js index 4af4945f..66c70d5a 100644 --- a/test/compress/reduce_vars.js +++ b/test/compress/reduce_vars.js @@ -7725,3 +7725,49 @@ issue_5050: { "3", ] } + +issue_5055_1: { + options = { + evaluate: true, + reduce_vars: true, + toplevel: true, + } + input: { + var a = "PASS"; + function f() { + console.log(a || "FAIL"); + } + f(0 && (a = 0)(f(this))); + } + expect: { + var a = "PASS"; + function f() { + console.log(a || "FAIL"); + } + f(0); + } + expect_stdout: "PASS" +} + +issue_5055_2: { + options = { + reduce_vars: true, + toplevel: true, + unused: true, + } + input: { + var a = "PASS"; + function f() { + console.log(a || "FAIL"); + } + f(0 && (a = 0)(f(this))); + } + expect: { + var a = "PASS"; + function f() { + console.log(a || "FAIL"); + } + f(0 && (a = 0)(f())); + } + expect_stdout: "PASS" +} |