fix corner case in hoist_props (#5223)

fixes #5222
This commit is contained in:
Alex Lam S.L
2021-12-15 18:57:34 +00:00
committed by GitHub
parent 509896a410
commit 9e927ecc9a
3 changed files with 41 additions and 0 deletions

View File

@@ -1957,3 +1957,37 @@ issue_5192: {
expect_stdout: "PASS"
node_version: ">=6"
}
issue_5222: {
options = {
hoist_props: true,
inline: true,
reduce_vars: true,
side_effects: true,
toplevel: true,
unused: true,
}
input: {
function f() {
do {
(function() {
var a = {
p: [ a ] = [],
};
})();
} while (console.log("PASS"));
}
f();
}
expect: {
(function() {
do {
a = void 0,
[ a ] = [];
} while (console.log("PASS"));
var a;
})();
}
expect_stdout: "PASS"
node_version: ">=6"
}