fix corner case in unused (#4147)

fixes #4146
This commit is contained in:
Alex Lam S.L
2020-09-22 13:08:45 +01:00
committed by GitHub
parent 6d4c0fa6fa
commit 3472cf1a90
3 changed files with 32 additions and 6 deletions

View File

@@ -2965,3 +2965,30 @@ issue_4144: {
}
expect_stdout: "PASS"
}
issue_4146: {
options = {
reduce_vars: true,
toplevel: true,
unused: true,
}
input: {
function f(a, b) {
function g() {}
var a = g;
var c = b;
c.p;
console.log(typeof a);
}
f("FAIL", 42);
}
expect: {
(function(a, b) {
a = function () {};
var c = b;
c.p;
console.log(typeof a);
})(0, 42);
}
expect_stdout: "function"
}