diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2018-02-04 03:58:49 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-04 03:58:49 +0800 |
commit | 78a44d5ab0fd2195c8f22cc8a39193b33dad6188 (patch) | |
tree | 83a542c49bea4577d66f400102dfe4da8676ba7a /test/compress/collapse_vars.js | |
parent | 7e13c0db4034d2c28e36473a3add915de1813844 (diff) | |
download | tracifyjs-78a44d5ab0fd2195c8f22cc8a39193b33dad6188.tar.gz tracifyjs-78a44d5ab0fd2195c8f22cc8a39193b33dad6188.zip |
maintain order between side-effects and externally observable assignments (#2879)
fixes #2878
Diffstat (limited to 'test/compress/collapse_vars.js')
-rw-r--r-- | test/compress/collapse_vars.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js index ad09edc3..4191de85 100644 --- a/test/compress/collapse_vars.js +++ b/test/compress/collapse_vars.js @@ -4433,3 +4433,37 @@ issue_2873_2: { } expect_stdout: "0 1" } + +issue_2878: { + options = { + collapse_vars: true, + sequences: true, + } + input: { + var c = 0; + (function (a, b) { + function f2() { + if (a) c++; + } + b = f2(); + a = 1; + b && b.b; + f2(); + })(); + console.log(c); + } + expect: { + var c = 0; + (function (a, b) { + function f2() { + if (a) c++; + } + b = f2(), + a = 1, + b && b.b, + f2(); + })(), + console.log(c); + } + expect_stdout: "1" +} |