fix corner case in unused (#1718)

When fixing catch-related issue in #1715, it tries to optimise for duplicate definitions but did not take anonymous functions into account.

Remove such optimisation for now and we can cover this as a more general rule later.
This commit is contained in:
Alex Lam S.L
2017-03-29 01:00:21 +08:00
committed by GitHub
parent 6ab3224c0d
commit eb48a035e7
2 changed files with 28 additions and 2 deletions

View File

@@ -931,3 +931,30 @@ issue_1715_3: {
}
expect_stdout: "1"
}
issue_1715_4: {
options = {
unused: true,
}
input: {
var a = 1;
!function a() {
a++;
try {} catch (a) {
var a;
}
}();
console.log(a);
}
expect: {
var a = 1;
!function() {
a++;
try {} catch (a) {
var a;
}
}();
console.log(a);
}
expect_stdout: "1"
}