fix corner case in reduce_vars (#5408)

fixes #5407
This commit is contained in:
Alex Lam S.L
2022-04-05 03:09:25 +01:00
committed by GitHub
parent d75a946707
commit ccd77d70db
2 changed files with 47 additions and 8 deletions

View File

@@ -2209,3 +2209,33 @@ issue_5340_3: {
expect_stdout: "undefined"
node_version: ">=6"
}
issue_5407: {
options = {
evaluate: true,
reduce_vars: true,
}
input: {
(function(a) {
for (var i = 0; i < 2; i++)
(function(b = 4) {
console.log(b);
a = 2;
})(a);
})();
}
expect: {
(function(a) {
for (var i = 0; i < 2; i++)
(function(b = 4) {
console.log(b);
a = 2;
})(a);
})();
}
expect_stdout: [
"4",
"2",
]
node_version: ">=6"
}