diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2018-05-10 18:45:20 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-10 18:45:20 +0800 |
commit | 7bc7704edfe0a8af39924889e58b3d67f135b230 (patch) | |
tree | 7c4020db1a121280e815db00f9d3213113764d2b /test/compress | |
parent | 14e712ee802da2a6199653268f8519187ece2c51 (diff) | |
download | tracifyjs-7bc7704edfe0a8af39924889e58b3d67f135b230.tar.gz tracifyjs-7bc7704edfe0a8af39924889e58b3d67f135b230.zip |
fix corner case in `reduce_vars` (#3129)
Diffstat (limited to 'test/compress')
-rw-r--r-- | test/compress/reduce_vars.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js index bc5fcf1b..ac55f81d 100644 --- a/test/compress/reduce_vars.js +++ b/test/compress/reduce_vars.js @@ -6059,6 +6059,38 @@ conditional_nested_2: { expect_stdout: "1" } +conditional_nested_3: { + options = { + evaluate: true, + reduce_vars: true, + } + input: { + var n = 2, c = 0; + (function f(a) { + 0 < n-- && g(a = 1); + function g() { + a && c++; + } + g(); + 0 < n-- && f(); + })(); + console.log(c); + } + expect: { + var n = 2, c = 0; + (function f(a) { + 0 < n-- && g(a = 1); + function g() { + a && c++; + } + g(); + 0 < n-- && f(); + })(); + console.log(c); + } + expect_stdout: "2" +} + issue_2436: { options = { evaluate: true, |