improve compression of undefined, NaN & Infinitiy (#1748)

- migrate transformation logic from `OutputStream` to `Compressor`
- always turn `undefined` into `void 0` (unless `unsafe`)
- always keep `NaN` except when avoiding local variable redefinition
- introduce `keep_infinity` to suppress `1/0` transform, except when avoiding local variable redefinition

supersedes #1723
fixes #1730
This commit is contained in:
Alex Lam S.L
2017-04-01 03:02:14 +08:00
committed by GitHub
parent 1ddc05725d
commit 257ddc3bdb
9 changed files with 170 additions and 56 deletions

View File

@@ -77,7 +77,7 @@ sub_properties: {
a[3.14] = 3;
a.if = 4;
a["foo bar"] = 5;
a[0/0] = 6;
a[NaN] = 6;
a[null] = 7;
a[void 0] = 8;
}