Age | Commit message (Collapse) | Author |
|
That particular version of Node.js has messed up error messages, so provide a version-specific workaround.
Also fixed an formatting issue which would cause `expect_stdout` to fail if error message contains excerpts of input.
Apply `expect_stdout` to more applicable tests.
|
|
The following is wrong:
`a == (b ? a : c)` => `b`
Because:
- `b` may not be boolean
- `a` might have side effects
- `a == a` is not always `true` (think `NaN`)
- `a == c` is not always `false`
|
|
Commit eab99a1c fails to account for side effects from compound assignments.
|
|
Guarded by `unsafe` as `charAt()` can be overridden.
|
|
allow test to pass if both `input` and `expect` throws the same kind of error
|
|
`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`.
|
|
|
|
|
|
`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
|
|
fixes #1588
|
|
fixes #1605
|
|
`hoist_vars` converts variable declarations into plain assignments, which then confuses `reduce_vars`
fixes #1606
|
|
As patched in #1597, `make_node_from_constant()` makes inconsistent and sometimes incorrect calls to `optimize()` and `transform()`.
Fix those issues properly by changing the semantics of `evaluate()` and `make_node_from_constant()`, with the side effect that `evaluate()` no longer eagerly converts constant to `AST_Node`.
|
|
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.
|
|
- remove obsolete optimisation in `AST_Binary` after #1477
- improve `TreeWalker.has_directive()` readability and resilience against multiple visits
|
|
|
|
fixes #1592
|
|
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
|
|
`expect_exact` sometimes have multiple lines and `\n` are hard to read.
Use array of strings to emulate line breaks and improve readability.
|
|
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.
|
|
|
|
`AST_Scope.def_variable()` will overwrite `AST_Symbol.thedef`, so save a copy before calling.
fixes #1586
|
|
|
|
- one-use function call => IIFE should take `eval()` & `arguments` into account
- if unused parameter cannot be eliminated, replace it with `0`
fixes #1583
|
|
|
|
- similar case as #1578 but against #1450 instead
- fix `this` binding in #1450 as well
closes #1580
|
|
|
|
fixes #1574
|
|
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
|
|
|
|
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
|
|
|
|
- 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
|
|
`side-effects` did not account for IIFEs being able to reference itself thus making its return value potentially significant
|
|
|
|
- report file sizes and overall run time
- exit with non-zero code upon error
|
|
`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.
|
|
- expose function body to call sites for potential optimisations
- suppress substitution of variable used within `AST_Defun`
|
|
- unless `toplevel` is enabled
- global `const` works as before
|
|
|
|
- unless both `beautify` & `screw-ie8` are enabled
- deprecate workaround for if-do-while-else
fixes #186
|
|
|
|
- `++a` is the one that is foldable
- transform `a++` into `++a` for better optimisation
|
|
|
|
- consolidate `cascade` optimisations
- support ++/-- postfixes
- remove redundant optimisation identified in #1460
fixes #368
|
|
accounts for IE8- scoping
|
|
`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.
|
|
- `undefined` etc. can be redefined at top-level for IE8-, so disable related optimisations
- fixed `--support-ie8` catch mangle bug
|
|
fixes #1332
|
|
|