fix corner case in dead_code (#4981)

This commit is contained in:
Alex Lam S.L
2021-05-29 20:16:18 +01:00
committed by GitHub
parent 260431f4e0
commit 8d23496e0f
2 changed files with 42 additions and 1 deletions

View File

@@ -260,6 +260,9 @@ block_scoped: {
expect: {
"use strict";
0;
{
class A {}
}
if (console) {
class B {}
}
@@ -269,6 +272,38 @@ block_scoped: {
node_version: ">=4"
}
retain_declaration: {
options = {
dead_code: true,
}
input: {
"use strict";
var a = "FAIL";
try {
console.log(function() {
return a;
class a {}
}());
} catch (e) {
console.log("PASS");
}
}
expect: {
"use strict";
var a = "FAIL";
try {
console.log(function() {
return a;
class a {}
}());
} catch (e) {
console.log("PASS");
}
}
expect_stdout: "PASS"
node_version: ">=4"
}
drop_extends: {
options = {
inline: true,