fix corner cases with block-scoped functions (#4695)

This commit is contained in:
Alex Lam S.L
2021-02-26 20:16:14 +00:00
committed by GitHub
parent ea52339502
commit ac26993b5a
6 changed files with 271 additions and 20 deletions

View File

@@ -53,8 +53,10 @@ dead_code_2_should_warn: {
g();
x = 10;
throw new Error("foo");
var x;
function g(){};
{
var x;
function g(){};
}
}
f();
}
@@ -62,7 +64,6 @@ dead_code_2_should_warn: {
expect_warnings: [
"WARN: Dropping unreachable code [test/compress/dead-code.js:8,12]",
]
node_version: "<=4"
}
dead_code_constant_boolean_should_warn_more: {
@@ -88,8 +89,10 @@ dead_code_constant_boolean_should_warn_more: {
bar();
}
expect: {
var foo;
function bar() {}
{
var foo;
function bar() {}
}
// nothing for the while
// as for the for, it should keep:
var x = 10, y;