fix dead_code on AST_Switch (#1667)

Need to call `extract_declarations_from_unreachable_code()`.

fixes #1663
This commit is contained in:
Alex Lam S.L
2017-03-25 16:21:42 +08:00
committed by GitHub
parent 491f16c766
commit 8ca2401ebe
2 changed files with 50 additions and 14 deletions

View File

@@ -258,3 +258,35 @@ keep_default: {
}
}
}
issue_1663: {
options = {
dead_code: true,
evaluate: true,
}
input: {
var a = 100, b = 10;
function f() {
switch (1) {
case 1:
b = a++;
return ++b;
default:
var b;
}
}
f();
console.log(a, b);
}
expect: {
var a = 100, b = 10;
function f() {
b = a++;
return ++b;
var b;
}
f();
console.log(a, b);
}
expect_stdout: true
}