enhance collapse_vars (#3572)

This commit is contained in:
Alex Lam S.L
2019-11-05 18:15:28 +08:00
committed by GitHub
parent 0e29ad5eb9
commit 3e2c51a4da
2 changed files with 79 additions and 5 deletions

View File

@@ -6387,3 +6387,51 @@ issue_3562: {
}
expect_stdout: "PASS PASS"
}
dot_throw_assign_sequence: {
options = {
collapse_vars: true,
}
input: {
var a = "FAIL";
try {
var b;
b[0] = (a = "PASS", 0);
a = 1 + a;
} catch (c) {
}
console.log(a);
}
expect: {
var a = "FAIL";
try {
var b;
b[0] = (a = "PASS", 0);
a = 1 + a;
} catch (c) {
}
console.log(a);
}
expect_stdout: "PASS"
}
call_assign_order: {
options = {
collapse_vars: true,
}
input: {
var a, b = 1, c = 0, log = console.log;
(function() {
a = b = "PASS";
})((b = "FAIL", c++));
log(a, b);
}
expect: {
var a, b = 1, c = 0, log = console.log;
(function() {
a = b = "PASS";
})((b = "FAIL", c++));
log(a, b);
}
expect_stdout: "PASS PASS"
}