improve inline efficiency (#2188)

... by teaching `collapse_vars` some new tricks.

fixes #2187
This commit is contained in:
Alex Lam S.L
2017-07-02 01:05:14 +08:00
committed by GitHub
parent 7659ea1d2e
commit d40950b741
6 changed files with 119 additions and 69 deletions

View File

@@ -1978,10 +1978,10 @@ chained_3: {
}
expect: {
console.log(function(a, b) {
var c = a, c = b;
var c = 1, c = b;
b++;
return c;
}(1, 2));
}(0, 2));
}
expect_stdout: "2"
}
@@ -2186,3 +2186,34 @@ compound_assignment: {
}
expect_stdout: "4"
}
issue_2187: {
options = {
collapse_vars: true,
unused: true,
}
input: {
var a = 1;
!function(foo) {
foo();
var a = 2;
console.log(a);
}(function() {
console.log(a);
});
}
expect: {
var a = 1;
!function(foo) {
foo();
var a = 2;
console.log(a);
}(function() {
console.log(a);
});
}
expect_stdout: [
"1",
"2",
]
}