Age | Commit message (Collapse) | Author |
|
|
|
|
|
- migrate de-facto compression to `conditionals` & `strings`
fixes #3689
|
|
|
|
|
|
- inline single-use function declarations as expressions when permissible
- depend on `reduce_vars`
- enabled by default
- disable for speed critical code
fixes #2464
|
|
|
|
|
|
shuffle associative operations to minimise parentheses and aid other uglification efforts
closes #1454
|
|
fixes
- [a].join() => "" + a
- ["a", , "b"].join() => "a,,b"
- ["a", null, "b"].join() => "a,,b"
- ["a", undefined, "b"].join() => "a,,b"
improvements
- ["a", "b"].join(null) => "anullb"
- ["a", "b"].join(undefined) => "a,b"
- [a + "b", c].join("") => a + "b" + c
closes #1453
|
|
improved reduce_vars & binary operands produce more optimal results
|
|
- gated by `unsafe`
- replaces previous optimisation specific to String.length
- "123"[0] => 1
- [1, 2, 3][0] => 1
- [1, 2, 3].length => 3
- does not apply to objects with overridden prototype functions
|
|
Somebody hit me with bug reports on this. :)
Refs #300
|
|
ev() should do a single thing — evaluate constant expressions. if that's
not possible, just return the original node. it's not the best place for
partial evaluation there, instead doing it in the compress functions.
|
|
Close #300
|
|
Follow-up to 78e98d2.
|
|
Close #298
|
|
1529ab96 started to do this (by considering holes to be separate from
"undefined") but it still converted
[1,,] (length 2, last element hole, trailing comma)
to
[1,] (length 1, trailing comma)
Unfortunately the test suite doesn't really make this clear: the new test here
passes with or without this patch because run-tests.js beautifys the expected
output (in "make_code"), which does the incorrect transformation! If you make
some manual change to arrays.js to make the test fail and see the INPUT and
OUTPUT, then you can see that without this fix, [1,,] -> [1,], and with this fix
it stays [1,,].
|
|
1b6bcca7 was a first attempt at this. That commit made Uglify stop replacing
holes with undefined, but instead it started replacing undefined with
holes. This is slightly problematic, because there is a difference between a
hole and an undefined value. More problematically, it changed [1,undefined] to
[1,] which generally doesn't even parse as a hole (just as a trailing comma), so
it didn't even preserve the length of the array!
Instead, parse holes as their own special AST node which prints invisibly.
|