fix corner case in switch (#1765)

This commit is contained in:
Alex Lam S.L
2017-04-02 17:07:20 +08:00
committed by GitHub
parent d57527697f
commit 9469c03ac9
2 changed files with 31 additions and 4 deletions

View File

@@ -24,3 +24,31 @@ case_1: {
}
expect_stdout: "0 2"
}
case_2: {
options = {
dead_code: true,
evaluate: true,
switches: true,
}
input: {
var a = 0, b = 1;
switch (0) {
default:
b = 2;
case a:
a = 3;
case 0:
}
console.log(a, b);
}
expect: {
var a = 0, b = 1;
switch (0) {
case a:
a = 3;
}
console.log(a, b);
}
expect_stdout: "3 1"
}