fix corner cases in loops & unused (#4995)

fixes #4994
This commit is contained in:
Alex Lam S.L
2021-06-10 00:58:33 +01:00
committed by GitHub
parent 8dbf0b042e
commit e70b84895c
3 changed files with 67 additions and 20 deletions

View File

@@ -1726,3 +1726,28 @@ issue_4916: {
expect_stdout: "undefined"
node_version: ">=6"
}
issue_4994: {
options = {
loops: true,
unused: true,
}
input: {
var a = "FAIL";
(function(b = function() {
for (a in { PASS: 42 });
}()) {
var a;
})();
console.log(a);
}
expect: {
var a = "FAIL";
(function(b = function() {
for (a in { PASS: 42 });
}()) {})();
console.log(a);
}
expect_stdout: "PASS"
node_version: ">=6"
}

View File

@@ -2592,3 +2592,36 @@ issue_4608_2: {
expect_stdout: "f"
node_version: ">=6"
}
issue_4994: {
options = {
loops: true,
unused: true,
}
input: {
var a = "FAIL";
(function([
{
[function() {
for (a in { PASS: null });
}()]: b,
},
]) {
var a;
})([ 42 ]);
console.log(a);
}
expect: {
var a = "FAIL";
(function([
{
[function() {
for (a in { PASS: null });
}()]: b,
},
]) {})([ 42 ]);
console.log(a);
}
expect_stdout: "PASS"
node_version: ">=6"
}