fix corner cases in functions (#3372)

fixes #3371
This commit is contained in:
Alex Lam S.L
2019-04-21 02:16:05 +08:00
committed by GitHub
parent 855964a87a
commit c719552317
3 changed files with 80 additions and 10 deletions

View File

@@ -646,3 +646,30 @@ issue_2904: {
}
expect_stdout: "1"
}
issue_3371: {
options = {
functions: true,
join_vars: true,
loops: true,
reduce_vars: true,
unused: true,
}
input: {
(function() {
var a = function() {
console.log("PASS");
};
while (a());
})();
}
expect: {
(function() {
function a() {
console.log("PASS");
}
for (; a(); );
})();
}
expect_stdout: "PASS"
}