improve unused over duplicate variable names (#2656)

This commit is contained in:
Alex Lam S.L
2017-12-26 18:29:28 +08:00
committed by GitHub
parent 86607156e3
commit 05e7d34ed4
2 changed files with 28 additions and 10 deletions

View File

@@ -1413,3 +1413,24 @@ issue_2516_2: {
Baz(2);
}
}
defun_lambda_same_name: {
options = {
toplevel: true,
unused: true,
}
input: {
function f(n) {
return n ? n * f(n - 1) : 1;
}
console.log(function f(n) {
return n ? n * f(n - 1) : 1;
}(5));
}
expect: {
console.log(function f(n) {
return n ? n * f(n - 1) : 1;
}(5));
}
expect_stdout: "120"
}