fix mangleProperties on identifiers (#1776)

- fix handling of "-Infinity"
- add test case for "-0"

reverts #1481
This commit is contained in:
Alex Lam S.L
2017-04-03 23:17:47 +08:00
committed by GitHub
parent a400741868
commit 48b3fe9952
2 changed files with 146 additions and 4 deletions

View File

@@ -47,6 +47,7 @@ function find_builtins() {
// NaN will be included due to Number.NaN
var a = [
"Infinity",
"-Infinity",
"undefined",
];
[ Object, Array, Function, Number,
@@ -153,7 +154,6 @@ function mangle_properties(ast, options) {
// only function declarations after this line
function can_mangle(name) {
if (!is_identifier(name)) return false;
if (unmangleable.indexOf(name) >= 0) return false;
if (reserved.indexOf(name) >= 0) return false;
if (options.only_cache) {