fix corner case in unused & yields (#5077)

fixes #5076
This commit is contained in:
Alex Lam S.L
2021-07-12 16:16:12 +01:00
committed by GitHub
parent 0d350b78bf
commit 92c3fddd7a
2 changed files with 46 additions and 10 deletions

View File

@@ -1246,3 +1246,32 @@ issue_5034: {
expect_stdout: "PASS"
node_version: ">=4"
}
issue_5076: {
options = {
evaluate: true,
hoist_vars: true,
passes: 2,
pure_getters: "strict",
side_effects: true,
toplevel: true,
unused: true,
yields: true,
}
input: {
var a;
console.log("PASS");
var b = function*({
p: {},
}) {}({
p: { a } = 42,
});
}
expect: {
var a;
console.log("PASS");
a = 42["a"];
}
expect_stdout: "PASS"
node_version: ">=6"
}