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

@@ -840,8 +840,8 @@ equality_conditionals_false: {
f(0, true, 0),
f(1, 2, 3),
f(1, null, 3),
f(0/0),
f(0/0, "foo");
f(NaN),
f(NaN, "foo");
}
expect_stdout: true
}
@@ -888,8 +888,8 @@ equality_conditionals_true: {
f(0, true, 0),
f(1, 2, 3),
f(1, null, 3),
f(0/0),
f(0/0, "foo");
f(NaN),
f(NaN, "foo");
}
expect_stdout: true
}