fix corner case in dead_code (#4984)

This commit is contained in:
Alex Lam S.L
2021-05-30 04:07:55 +01:00
committed by GitHub
parent b9d5bba5fb
commit 7e88d52fae
2 changed files with 35 additions and 3 deletions

View File

@@ -20,6 +20,39 @@ retain_block: {
node_version: ">=4"
}
retain_assignment: {
options = {
dead_code: true,
reduce_vars: true,
}
input: {
"use strict";
function f() {
return a = 0;
let a;
}
try {
f();
} catch (e) {
console.log("PASS");
}
}
expect: {
"use strict";
function f() {
return a = 0;
let a;
}
try {
f();
} catch (e) {
console.log("PASS");
}
}
expect_stdout: "PASS"
node_version: ">=4"
}
retain_catch: {
options = {
dead_code: true,
@@ -897,6 +930,7 @@ issue_4210: {
issue_4212_1: {
options = {
dead_code: true,
reduce_vars: true,
}
input: {
"use strict";