diff options
author | kzc <zaxxon2011@gmail.com> | 2016-01-27 18:35:49 -0500 |
---|---|---|
committer | Richard van Velzen <rvanvelzen@experty.com> | 2016-01-28 16:48:50 +0100 |
commit | af2472d85e25e2bddad0b663b38281aeb61536e9 (patch) | |
tree | c31401a0464dbb3caa240efaf5a39ae89f213b52 /test | |
parent | 3eb9101918e1c8127f960624bd11f3707215b012 (diff) | |
download | tracifyjs-af2472d85e25e2bddad0b663b38281aeb61536e9.tar.gz tracifyjs-af2472d85e25e2bddad0b663b38281aeb61536e9.zip |
collapse_vars: fix bug in repeated var defs of same name
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/collapse_vars.js | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js index f67b3f47..39fee597 100644 --- a/test/compress/collapse_vars.js +++ b/test/compress/collapse_vars.js @@ -685,19 +685,35 @@ collapse_vars_repeated: { var dummy = 3, a = 5, unused = 2, a = 1, a = 3; return -a; } - function f2() { - var a = 3, a = a + 2; + function f2(x) { + var a = 3, a = x; return a; } + (function(x){ + var a = "GOOD" + x, e = "BAD", k = "!", e = a; + console.log(e + k); + })("!"), + + (function(x){ + var a = "GOOD" + x, e = "BAD" + x, k = "!", e = a; + console.log(e + k); + })("!"); } expect: { function f1() { return -3 } - function f2() { - var a = 3, a = a + 2; - return a - } + function f2(x) { + return x + } + (function(x){ + var a = "GOOD" + x, e = "BAD", e = a; + console.log(e + "!"); + })("!"), + (function(x){ + var a = "GOOD" + x, e = "BAD" + x, e = a; + console.log(e + "!"); + })("!"); } } |