handle function/variable name collisions correctly (#3451)

fixes #3439
This commit is contained in:
Alex Lam S.L
2019-10-06 08:51:38 +08:00
committed by GitHub
parent d57b606e73
commit 35338a100f
3 changed files with 71 additions and 7 deletions

View File

@@ -6197,3 +6197,43 @@ Infinity_assignment: {
}
expect_stdout: true
}
issue_3439_1: {
options = {
collapse_vars: true,
unused: true,
}
input: {
console.log(typeof function(a) {
function a() {}
return a;
}(42));
}
expect: {
console.log(typeof function(a) {
function a() {}
return a;
}(42));
}
expect_stdout: "function"
}
issue_3439_2: {
options = {
collapse_vars: true,
unused: true,
}
input: {
console.log(typeof function() {
var a = 42;
function a() {}
return a;
}());
}
expect: {
console.log(typeof function() {
return 42;
}());
}
expect_stdout: "number"
}