fix mangleProperties of undefined & Infinity (#1772)

`NaN` already works by the happy accident of `Number.NaN`

fixes #1770
This commit is contained in:
Alex Lam S.L
2017-04-03 12:31:05 +08:00
committed by GitHub
parent 1f1fccc45d
commit 59a4e56bc8
2 changed files with 53 additions and 1 deletions

View File

@@ -44,7 +44,11 @@
"use strict";
function find_builtins() {
var a = [];
// NaN will be included due to Number.NaN
var a = [
"Infinity",
"undefined",
];
[ Object, Array, Function, Number,
String, Boolean, Error, Math,
Date, RegExp

View File

@@ -0,0 +1,48 @@
mangle_props: {
mangle_props = {}
input: {
var obj = {
undefined: 1,
NaN: 2,
Infinity: 3,
"-Infinity": 4,
};
console.log(
obj[void 0],
obj[undefined],
obj["undefined"],
obj[0/0],
obj[NaN],
obj["NaN"],
obj[1/0],
obj[Infinity],
obj["Infinity"],
obj[-1/0],
obj[-Infinity],
obj["-Infinity"]
);
}
expect: {
var obj = {
undefined: 1,
NaN: 2,
Infinity: 3,
"-Infinity": 4,
};
console.log(
obj[void 0],
obj[void 0],
obj["undefined"],
obj[0/0],
obj[NaN],
obj["NaN"],
obj[1/0],
obj[1/0],
obj["Infinity"],
obj[-1/0],
obj[-1/0],
obj["-Infinity"]
);
}
expect_stdout: true
}