fix various corner cases (#3123)

This commit is contained in:
Alex Lam S.L
2018-05-05 13:17:50 +08:00
committed by GitHub
parent d835c72c80
commit f37b91879f
3 changed files with 84 additions and 20 deletions

View File

@@ -4056,6 +4056,36 @@ replace_all_var: {
expect_stdout: "PASS"
}
replace_all_var_scope: {
rename = true;
options = {
collapse_vars: true,
unused: true,
}
mangle = {}
input: {
var a = 100, b = 10;
(function(r, a) {
switch (~a) {
case (b += a):
case a++:
}
})(--b, a);
console.log(a, b);
}
expect: {
var a = 100, b = 10;
(function(c, o) {
switch (~a) {
case (b += a):
case o++:
}
})(--b, a);
console.log(a, b);
}
expect_stdout: "100 109"
}
cascade_statement: {
options = {
collapse_vars: true,