diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2018-02-09 06:54:37 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-09 06:54:37 +0800 |
commit | 2088e1c19d97955b5582e08396fca8c7b7dadd83 (patch) | |
tree | 18b818338585fa9f69be2f1eb296273bf80ab508 /test | |
parent | bf1d47180c87462b1605157eb15b31c9db2c1249 (diff) | |
download | tracifyjs-2088e1c19d97955b5582e08396fca8c7b7dadd83.tar.gz tracifyjs-2088e1c19d97955b5582e08396fca8c7b7dadd83.zip |
fix AST corruption due to `collapse_vars` & `inline` (#2899)
fixes #2898
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/functions.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/compress/functions.js b/test/compress/functions.js index 87328820..a964f104 100644 --- a/test/compress/functions.js +++ b/test/compress/functions.js @@ -1989,3 +1989,33 @@ issue_2783: { } expect_stdout: "PASS" } + +issue_2898: { + options = { + collapse_vars: true, + inline: true, + reduce_vars: true, + sequences: true, + unused: true, + } + input: { + var c = 0; + (function() { + while (f()); + function f() { + var b = (c = 1 + c, void (c = 1 + c)); + b && b[0]; + } + })(); + console.log(c); + } + expect: { + var c = 0; + (function() { + while (b = void 0, void ((b = void (c = 1 + (c = 1 + c))) && b[0])); + var b; + })(), + console.log(c); + } + expect_stdout: "2" +} |