improve unused on built-in functions (#2817)

This commit is contained in:
Alex Lam S.L
2018-01-19 20:41:57 +08:00
committed by GitHub
parent e21bab7ce6
commit 3e7873217c
4 changed files with 205 additions and 87 deletions

View File

@@ -4089,3 +4089,26 @@ cascade_forin: {
"2",
]
}
unsafe_builtin: {
options = {
collapse_vars: true,
pure_getters: "strict",
unsafe: true,
unused: true,
}
input: {
function f(a) {
var b = Math.abs(a);
return Math.pow(b, 2);
}
console.log(f(-1), f(2));
}
expect: {
function f(a) {
return Math.pow(Math.abs(a), 2);
}
console.log(f(-1), f(2));
}
expect_stdout: "1 4"
}