collapse_vars: fix bug in repeated var defs of same name

This commit is contained in:
kzc
2016-01-27 18:35:49 -05:00
committed by Richard van Velzen
parent 3eb9101918
commit af2472d85e
2 changed files with 33 additions and 8 deletions

View File

@@ -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 + "!");
})("!");
}
}