fix unsafe evaluate of function property (#2927)

fixes #2926
This commit is contained in:
Alex Lam S.L
2018-02-17 21:33:36 +08:00
committed by GitHub
parent 7fdd2082a6
commit 82d1ef0242
2 changed files with 44 additions and 2 deletions

View File

@@ -1502,3 +1502,36 @@ issue_2919: {
console.log("function(){}");
}
}
issue_2926_1: {
options = {
evaluate: true,
reduce_vars: true,
unsafe: true,
}
input: {
(function f(a) {
console.log(f.name.length, f.length);
})();
}
expect: {
(function f(a) {
console.log(1, 1);
})();
}
expect_stdout: "1 1"
}
issue_2926_2: {
options = {
evaluate: true,
unsafe: true,
}
input: {
console.log(typeof function() {}.valueOf());
}
expect: {
console.log("function");
}
expect_stdout: "function"
}