fix corner case in unused (#5708)

fixes #5707
This commit is contained in:
Alex Lam S.L
2022-10-10 14:45:57 +01:00
committed by GitHub
parent bccb1c3bd9
commit 7edd10e5e5
3 changed files with 29 additions and 3 deletions

View File

@@ -2018,3 +2018,24 @@ issue_5684: {
expect_stdout: "PASS"
node_version: ">=10"
}
issue_5707: {
options = {
hoist_props: true,
reduce_vars: true,
side_effects: true,
toplevel: true,
unused: true,
yields: true,
}
input: {
var a, b;
function* f(c = (b = 42, console.log("PASS"))) {}
b = f();
}
expect: {
console.log("PASS");
}
expect_stdout: "PASS"
node_version: ">=6"
}