diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2019-10-26 05:41:02 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-26 05:41:02 +0800 |
commit | 85237b08d46c62a97c9b338c4e62d71cdba76e24 (patch) | |
tree | f49863e73bab96aa00bd8ab780929a38be6bf9cf /test/compress/collapse_vars.js | |
parent | 27b159e711b1f0fc0a3c75672d9db33dfe023d67 (diff) | |
download | tracifyjs-85237b08d46c62a97c9b338c4e62d71cdba76e24.tar.gz tracifyjs-85237b08d46c62a97c9b338c4e62d71cdba76e24.zip |
fix corner case in `collapse_vars` (#3527)
fixes #3526
Diffstat (limited to 'test/compress/collapse_vars.js')
-rw-r--r-- | test/compress/collapse_vars.js | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js index 5723f6d9..858d3d41 100644 --- a/test/compress/collapse_vars.js +++ b/test/compress/collapse_vars.js @@ -6296,3 +6296,55 @@ issue_3520: { } expect_stdout: "2" } + +issue_3526_1: { + options = { + collapse_vars: true, + } + input: { + var b = function() { + this.a = "FAIL"; + }(); + var a = "PASS"; + var b; + var c = b; + console.log(a); + } + expect: { + var b = function() { + this.a = "FAIL"; + }(); + var a = "PASS"; + var b; + var c = b; + console.log(a); + } + expect_stdout: "PASS" +} + +issue_3526_2: { + options = { + collapse_vars: true, + } + input: { + function f() { + this.a = "FAIL"; + } + var b = f(); + var a = "PASS"; + var b; + var c = b; + console.log(a); + } + expect: { + function f() { + this.a = "FAIL"; + } + var b = f(); + var a = "PASS"; + var b; + var c = b; + console.log(a); + } + expect_stdout: "PASS" +} |