fix switch branch elimination (#1752)

Merge unreachable case body with previous fallthrough case

fixes #1750
This commit is contained in:
Alex Lam S.L
2017-04-01 17:19:57 +08:00
committed by GitHub
parent 87f6e1b091
commit ee3fe0f4cd
2 changed files with 49 additions and 25 deletions

View File

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