fix recursive function inline (#2738)

fixes #2737
This commit is contained in:
Alex Lam S.L
2018-01-07 15:31:24 +08:00
committed by GitHub
parent 8430c2f9f8
commit 1ee8be8d91
2 changed files with 49 additions and 2 deletions

View File

@@ -1905,3 +1905,49 @@ duplicate_arg_var: {
}
expect_stdout: "PASS"
}
issue_2737_1: {
options = {
inline: true,
reduce_vars: true,
unused: true,
}
input: {
(function(a) {
while (a());
})(function f() {
console.log(typeof f);
});
}
expect: {
(function(a) {
while (a());
})(function f() {
console.log(typeof f);
});
}
expect_stdout: "function"
}
issue_2737_2: {
options = {
inline: true,
reduce_vars: true,
unused: true,
}
input: {
(function(bar) {
for (;bar(); ) break;
})(function qux() {
return console.log("PASS"), qux;
});
}
expect: {
(function(bar) {
for (;bar(); ) break;
})(function qux() {
return console.log("PASS"), qux;
});
}
expect_stdout: "PASS"
}