aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/propmangle.js6
-rw-r--r--test/compress/issue-1770.js48
2 files changed, 53 insertions, 1 deletions
diff --git a/lib/propmangle.js b/lib/propmangle.js
index cfa035d2..c1e8c7e4 100644
--- a/lib/propmangle.js
+++ b/lib/propmangle.js
@@ -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
diff --git a/test/compress/issue-1770.js b/test/compress/issue-1770.js
new file mode 100644
index 00000000..69df8960
--- /dev/null
+++ b/test/compress/issue-1770.js
@@ -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
+}