aboutsummaryrefslogtreecommitdiff
path: root/lib/compress.js
AgeCommit message (Collapse)Author
2015-04-13Fix compression of conditionalsMihai Bazon
Don't move the condition on the right side of an assignment when the left side may have side effects. Fix #677
2015-03-23Fix compressing `![foo()];` as a statementMihai Bazon
need to check whether the literal has any side effects before replacing that with `false`.
2015-03-22[sequencesize] Actually even better:Mihai Bazon
do create the sequence even if the stat list is bigger than 2000 statements, but limit the sequence itself to 2000 expressions. Ref #414
2015-03-22Avoid sequencesize for more than 2000 statements.Mihai Bazon
It hardly saves any bytes for a sequence so long, and it risks blowing the stack with the recursive Seq functions. Ref #414
2015-03-22Add start/end nodes for NaN/Infinity transformationsMihai Bazon
2015-03-20Keep unused function arguments by defaultMihai Bazon
Discarding unused function arguments affects function.length, which can lead to some hard to debug issues. This optimization is now done only in "unsafe mode". Fix #121
2015-02-11Fix invalid removal of left side in && and || compressionRichard van Velzen
See #637. This does not produce the optimal result, but it does prevent the removal of non-side-effect-free code.
2015-01-31Drop all `console` statements properlyRichard van Velzen
Because the base reference can be an member expression as well, we have to dig a bit deeper to find the leftmost base reference. Fixes #451
2015-01-13Optimize conditionals where the consequent and alternative are both booleans ↵Tal Ater
and not equivalent
2015-01-12Replace the correct node when replacing in `void` sequencesRichard van Velzen
Close #611.
2015-01-11Merge pull request #482 from arty-name/inline-ng-injectMihai Bazon
added @ngInject support for inline functions
2015-01-07Fix make_node_from_constant for Regexp-sMihai Bazon
Close #588
2015-01-06aborts(AST_If) returns the `if` nodeMihai Bazon
Previously it returned the abort node from the alternative branch. This is not much use as it can be different from the one in the body branch (i.e. return vs. throw) and can trick us into issues like #591. Fix #591
2015-01-05Support keep_fnames in compressor, and --keep-fnames. #552Mihai Bazon
Passing `--keep-fnames` will enable it both for compressor/mangler, so that function names will not be dropped (when unused) nor mangled.
2015-01-04Fix #569Richard van Velzen
When no arguments are given to `new Function()`, it should be treated as a regular anonymous function (http://es5.github.io/#x15.3.2.1)
2014-12-31Fix #597Richard van Velzen
NaN and Infinity were replaced in the output generation, instead of during compression. This could lead to results where `1/0` was inserted without parens leading to invalid output. The nodes are replaced in the compression step now, and the output generation returns their regular names. This should not be a problem, since they're already only constructed from the original name.
2014-09-28Referencing a global is assumed to have side effects.Mihai Bazon
Close #550
2014-09-04Compress conditions that have side effects using sequencesTal Ater
2014-09-02Compress conditional assignments where all possible outcomes are equivalant ↵Tal Ater
and condition has no side effects
2014-08-26Turn foo.new into foo["new"] when not --screw-ie8. Fix #534Mihai Bazon
2014-08-20Prevent error for Function(""). Close #538Mihai Bazon
2014-07-01Evaluate "foo".length ==> 3Dan Wolff
2014-05-11added @ngInject support for inline functionsArtemy Tregubenko
2014-02-08Add option `keep_fargs`.Mihai Bazon
By default it's `false`. Pass `true` if you need to keep unused function arguments. Close #188.
2014-02-06Simplify nested conditionals if possibleMatt Basta
2014-01-31Fix if_return dropping the alternative. Close #413Mihai Bazon
2014-01-08Better process_for_angular before other statement reductions. #395Mihai Bazon
2014-01-08Support @ngInject with `angular` compressor option. Close #395.Mihai Bazon
2014-01-07doh.Mihai Bazon
2014-01-07minor: exp["10"] => exp[10]Mihai Bazon
2013-12-29Conditional/call optimizationMihai Bazon
foo ? bar(x) : bar(y) ==> bar(foo ? x : y)
2013-12-22Optimize seq,void 0. Close #377.Mihai Bazon
(x, void 0) => void x (x, undefined) => void x
2013-12-10Add `drop_console` option to the compressorMihai Bazon
2013-12-10minorMihai Bazon
2013-11-28Properly scope `catch` identifier when --screw-ie8Mihai Bazon
Fix #344
2013-11-20Fix faulty compressionMihai Bazon
`String(x + 5)` is not always the same as `x + "5"`. Overlooked that. :-( Close #350
2013-11-08Only descend twice after drop_unused if it's the same node type.Mihai Bazon
Fix #345
2013-11-06Better fix for #343Mihai Bazon
We can in fact lift sequences, but only if the operation is assignment and the left-hand side has no side effects nor property access -- that should guarantee that whatever we place before it cannot affect the sense of the assignment. Dropped contrived test case (too hard to support it now), added a more meaningful one.
2013-11-06Do not lift sequence from right-hand side of binary operation. Fix #343Mihai Bazon
2013-10-30Fix regression after e4c530240650535d1cb46569dfb013193471af05Mihai Bazon
`x * (y * z)` ==> `x * y * z` -- the better place to do this is in the compressor rather than codegen.
2013-10-30indentationMihai Bazon
2013-10-29Disallow reversal where lhs has higher or equal precedenceRichard van Velzen
Fixes #267
2013-10-26Fix RHS concat (raised in #330)Richard van Velzen
When attempting to concat the left-side of the rhs, make sure the rhs is a string.
2013-10-24Fix #269Richard van Velzen
Shorten most primitives where possible. Also optimize some edge cases.
2013-10-23Fix #280Richard van Velzen
The `init` of the `ForStatement` is not a `BlockStatement` before it was descended. The descend has to happen first, and *then* the actual checks.
2013-10-22Revert #3a81f60 for nowMihai Bazon
(with it some tests break and it can generate invalid output, see issue #44)
2013-10-09wrap upMihai Bazon
2013-10-09Don't drop_unused before compression.Mihai Bazon
Fix #280, #282
2013-10-04Rename clean_getters to pure_getters; add pure_funcs.Mihai Bazon
2013-10-02add `clean_getters` compressor option (default `false`)Mihai Bazon
allows one to specify if `foo.bar` is considered to have side effects.