fix corner case in hoist_vars (#5627)

fixes #5626
This commit is contained in:
Alex Lam S.L
2022-08-23 17:19:47 +01:00
committed by GitHub
parent 4653e8aec0
commit 4db81065ee
6 changed files with 119 additions and 65 deletions

View File

@@ -1,17 +1,18 @@
keep_var_for_in: {
options = {
hoist_vars: true,
join_vars: true,
unused: true,
}
input: {
(function(obj){
(function(obj) {
var foo = 5;
for (var i in obj)
return foo;
})();
}
expect: {
(function(obj){
(function(obj) {
var i, foo = 5;
for (i in obj)
return foo;