aboutsummaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2017-03-19transform String.charAt() to index access (#1620)Alex Lam S.L
Guarded by `unsafe` as `charAt()` can be overridden.
2017-03-18handle runtime errors in `expect_stdout` (#1618)Alex Lam S.L
allow test to pass if both `input` and `expect` throws the same kind of error
2017-03-18fix top-level directives in compress tests (#1615)Alex Lam S.L
`input` and `expect` are parsed as `AST_BlockStatement` which does not support `AST_Directive` by default. Emulate that by transforming preceding `AST_SimpleStatement`s of `AST_String` into `AST_Directive`.
2017-03-17fix chained evaluation (#1610)Alex Lam S.L
`reduce_vars` enables substitution of variables but did not clone the value's `AST_Node`. This confuses `collapse_vars` and result in invalid AST and subsequent crash. fixes #1609
2017-03-16extend `test/run-tests.js` to optionally execute uglified output (#1604)Alex Lam S.L
fixes #1588
2017-03-16make `collapse_vars` consistent with `toplevel` (#1608)Alex Lam S.L
fixes #1605
2017-03-16fix `hoist_vars` on `reduce_vars` (#1607)Alex Lam S.L
`hoist_vars` converts variable declarations into plain assignments, which then confuses `reduce_vars` fixes #1606
2017-03-15fix `AST_Node.optimize()` (#1602)Alex Lam S.L
Liberal use of `Compressor.transform()` and `AST_Node.optimize()` presents an issue for look-up operations like `TreeWalker.in_boolean_context()` and `TreeWalker.parent()`. This is an incremental fix such that `AST_Node.optimize()` would now contain the correct stack information when called correctly.
2017-03-11disallow parameter substitution for named IIFEs (#1596)Alex Lam S.L
Self-referenced function has non-fixed values assigned to its parameters. Let `unused` & `!keep_fnames` do the scanning, then apply `reduce_vars` only to unnamed functions. fixes #1595
2017-03-10support multi-line string in tests (#1590)Alex Lam S.L
`expect_exact` sometimes have multiple lines and `\n` are hard to read. Use array of strings to emulate line breaks and improve readability.
2017-03-10fixup for #1585 (#1589)Alex Lam S.L
As patched on `harmony`, `statement()` is the only user of `embed_tokens()` with a missing error branch. Updated test case and match up with `harmony` to facilitate future merging.
2017-03-10fix catch variable reference in IE8 (#1587)Alex Lam S.L
`AST_Scope.def_variable()` will overwrite `AST_Symbol.thedef`, so save a copy before calling. fixes #1586
2017-03-10Correctly raise a parse exception with a missing loop body (#1585)Michael Mior
2017-03-09fix & improve function argument compression (#1584)Alex Lam S.L
- one-use function call => IIFE should take `eval()` & `arguments` into account - if unused parameter cannot be eliminated, replace it with `0` fixes #1583
2017-03-09scan RHS of dropped assignments (#1581)Alex Lam S.L
- similar case as #1578 but against #1450 instead - fix `this` binding in #1450 as well closes #1580
2017-03-08scan assignment value in drop_unused() (#1578)Alex Lam S.L
those were not optimised for `unused` before, which made it necessary for `reduce_vars` to have separate steps for `keep_fnames` docs update by @kzc closes #1577
2017-03-08fix function name eliminiation (#1576)Alex Lam S.L
Function expression can be assigned to a variable and be given a name. Ensure function name is the reduced variable before clearing it out. fixes #1573 fixes #1575
2017-03-08only run benchmark & jetstream on CI (#1571)Alex Lam S.L
2017-03-08plan B for IE8 do-while semi-colon fix (#1572)Alex Lam S.L
- omitting trailing semi-colon in do-while breaks non-browser parser, e.g. uglify-js 1.x - trailing semi-colon only breaks IE8 if followed by `else` or `while` - always use braces in do-while body to workaround 2nd case with no size loss in compression fixes #1568
2017-03-08fix return from recursive IIFE (#1570)Alex Lam S.L
`side-effects` did not account for IIFEs being able to reference itself thus making its return value potentially significant
2017-03-07include benchmark.js in test suite (#1564)Alex Lam S.L
- report file sizes and overall run time - exit with non-zero code upon error
2017-03-07fix deep cloning of labels (#1565)Alex Lam S.L
`AST_Label.references` get `.initialize()` to `[]` every time after `.clone()` So walk down the tree to pick up the cloned `AST_LoopControl` pieces and put it back together.
2017-03-07transform function calls to IIFEs (#1560)Alex Lam S.L
- expose function body to call sites for potential optimisations - suppress substitution of variable used within `AST_Defun`
2017-03-07avoid substitution of global variables (#1557)Alex Lam S.L
- unless `toplevel` is enabled - global `const` works as before
2017-03-07collapse_vars: do not replace a constant in loop condition or init (#1562)kzc
2017-03-06suppress semicolons after do/while (#1556)Alex Lam S.L
- unless both `beautify` & `screw-ie8` are enabled - deprecate workaround for if-do-while-else fixes #186
2017-03-05fixup for #1553 (#1555)Alex Lam S.L
- `++a` is the one that is foldable - transform `a++` into `++a` for better optimisation
2017-03-05collapse assignment with adjacent subsequent usage (#1553)Alex Lam S.L
- consolidate `cascade` optimisations - support ++/-- postfixes - remove redundant optimisation identified in #1460 fixes #368
2017-03-05handle variable declaration within catch blocks (#1546)Alex Lam S.L
accounts for IE8- scoping
2017-03-05improve `unsafe` on undefined (#1548)Alex Lam S.L
`unsafe` turns undefined keyword into a variable of the same name if found, but that interferes with other related optimisations. Keep track of such transformations to ensure zero information loss in the process.
2017-03-05stay safe with constants in IE8- (#1547)Alex Lam S.L
- `undefined` etc. can be redefined at top-level for IE8-, so disable related optimisations - fixed `--support-ie8` catch mangle bug
2017-03-05fix handling of shebang and preamble (#1545)Alex Lam S.L
fixes #1332
2017-03-05fix a corner case in #1530 (#1552)Alex Lam S.L
2017-03-03process code with implicit return statement (#1522)Alex Lam S.L
Bookmarklet for instance implicitedly assumes a "completion value" without using `return`. The `expression` option now supports such use cases. Optimisations on IIFEs also enhanced. fixes #354 fixes #543 fixes #625 fixes #628 fixes #640 closes #1293
2017-03-03compress numerical expressions (#1513)Alex Lam S.L
safe operations - `a === b` => `a == b` - `a + -b` => `a - b` - `-a + b` => `b - a` - `a+ +b` => `+b+a` associative operations (bit-wise operations are safe, otherwise `unsafe_math`) - `a + (b + c)` => `(a + b) + c` - `(n + 2) + 3` => `5 + n` - `(2 * n) * 3` => `6 * n` - `(a | 1) | (2 | d)` => `(3 | a) | b` fixes #412
2017-03-03fix chained assignment with `unused` (#1540)Alex Lam S.L
When #1450 optimises `a=b=42`, it stops after the first variable even if both are unused. fixes #1539
2017-03-03collapse_vars should not replace constant in for-in init section (#1538)kzc
fixes #1537
2017-03-03properly cover all cases of for-in loop variables (#1536)Alex Lam S.L
2017-03-03fix reference marking in for-in loops (#1535)Alex Lam S.L
fixes #1533
2017-03-03disable do{...}while(false) optimisation (#1534)Alex Lam S.L
- fails to handle `break` in body fixes #1532
2017-03-02optimize trivial IIFEs returning constants (#1530)kzc
2017-03-02trim unused invocation parameters (#1526)Alex Lam S.L
2017-03-02minor improvement to string optimisation (#1514)Alex Lam S.L
- "" + "a" => "a" - "" + a + "b" => a + "b" - "a" + "" => "a" (improving on #45)
2017-03-02fix corner cases in `reduce_vars` (#1524)Alex Lam S.L
Avoid variable substitution in the following cases: - use of variable before declaration - declaration within conditional code blocks - declaration within loop body fixes #1518 fixes #1525
2017-03-01invert `reduce_vars` tracking flag (#1519)Alex Lam S.L
Modules like webpack and grunt-contrib-uglify still uses `ast.transform(compressor)` before `Compressor.compress(ast)` was introduced. Workaround this compatibility issue by deactivating `reduce_vars` in such case. Also fix use case with omitted `options` when calling `Compressor()`. fixes #1516
2017-03-01fix `evaluate` on object getter & setter (#1515)Alex Lam S.L
2017-02-28warn & drop `#__PURE__` iff IIFE is dropped (#1511)Alex Lam S.L
- consolidate `side-effects` optimisations - improve string `+` optimisation - enhance literal & `conditionals` optimisations
2017-02-27improve error messages (#1506)Alex Lam S.L
- better inheritance of `Error` sub-classes - mark parse error against source in CLI closes #235 closes #348 closes #524 closes #1356 closes #1405
2017-02-26consolidate `evaluate` & `reduce_vars` (#1505)Alex Lam S.L
- improve marking efficiency - apply smarter `const` replacement to `var` fixes #1501
2017-02-25allow --in-source-map inline (#1490)Alex Lam S.L
- limited to one input file (or `stdin`) - only works with built-in parser fixes #520