fix corner case in hoist_props (#5442)

fixes #5441
This commit is contained in:
Alex Lam S.L
2022-05-15 23:49:09 +01:00
committed by GitHub
parent e31bbe329a
commit 7db2ada880
3 changed files with 41 additions and 7 deletions

View File

@@ -1176,3 +1176,30 @@ issue_5182: {
"42",
]
}
issue_5441: {
options = {
hoist_props: true,
passes: 2,
reduce_vars: true,
side_effects: true,
}
input: {
console.log(function(a) {
(function() {
a = { p: this };
})();
return typeof a;
}());
}
expect: {
console.log(function(a) {
(function() {
a_p = this;
})();
var a_p;
return typeof {};
}());
}
expect_stdout: "object"
}