fix corner case in functions (#3403)

fixes #3402
This commit is contained in:
Alex Lam S.L
2019-05-11 18:55:45 +08:00
committed by GitHub
parent 5476cb8f05
commit 9fc8cd4076
3 changed files with 79 additions and 0 deletions

View File

@@ -311,3 +311,39 @@ issue_3375: {
}
expect_stdout: "string"
}
issue_3402: {
options = {
assignments: true,
evaluate: true,
functions: true,
passes: 2,
reduce_vars: true,
side_effects: true,
toplevel: true,
typeofs: true,
unused: true,
}
input: {
var f = function f() {
f = 42;
console.log(typeof f);
};
"function" == typeof f && f();
"function" == typeof f && f();
console.log(typeof f);
}
expect: {
function f() {
console.log(typeof f);
}
f();
f();
console.log(typeof f);
}
expect_stdout: [
"function",
"function",
"function",
]
}