Commit Graph

825 Commits

Author SHA1 Message Date
kzc f4c2ea37bf Collapse single use var definitions
Fix #721
2016-01-27 11:48:15 +02:00
Richard van Velzen b5a7197ae5 Merge pull request #928 from STRML/constPragma
Mark vars with /** @const */ pragma as consts so they can be eliminated.
2016-01-20 19:04:36 +01:00
Samuel Reed 1b703349cf Tighten up @const regex. 2016-01-20 11:35:45 -06:00
Samuel Reed f97da4294a Use TreeWalker for more accurate @const results and update tests 2016-01-20 10:54:00 -06:00
Samuel Reed 8b71c6559b Mark vars with /** @const */ pragma as consts so they can be eliminated.
Fixes older browser support for consts and allows more flexibility
in dead code removal.
2016-01-19 13:23:02 -06:00
Anthony Van de Gejuchte 26641f3fb2 Allow operator names as getters/setters
Fixes #919

Fix provided by @kzc
2016-01-19 19:28:51 +01:00
Anthony Van de Gejuchte 70e5b6f15b Add some tests for comment-filters through api
Also never bother comment options to filter comment5/shebang comments
as they have their custom filter.
2016-01-19 19:14:19 +01:00
Anthony Van de Gejuchte 8439c8ba98 Make arguments test slightly more strict 2016-01-15 00:04:05 +01:00
Anthony Van de Gejuchte 5c4e470d43 Add scope test for arguments 2016-01-14 22:32:46 +01:00
Anthony Van de Gejuchte 6605d15783 Never mangle arguments and keep them in their scope
Fixes #892

Helped-by: kzc
2016-01-14 19:45:52 +01:00
Richard van Velzen ac8db977b9 Merge pull request #905 from avdg/unit-tests
Add unit tests
2016-01-14 08:54:40 +01:00
Anthony Van de Gejuchte 88b77ddaa9 Add test case for line continuation 2016-01-13 00:34:56 +01:00
Mihai Bazon fe4e9f9d97 Fix hoisting the var in ForIn
Close #913
2016-01-05 13:56:52 +02:00
Anthony Van de Gejuchte 8c6af09ae0 Add mocha tests 2015-12-27 22:38:20 +01:00
Richard van Velzen 60c4030a4d Merge pull request #874 from kzc/fix-conditionals
#873 Fix `conditionals` optimizations with default compress options
2015-12-26 14:28:33 +01:00
Anthony Van de Gejuchte 0cabedc526 Disable loop optimization for parse-only tests 2015-12-18 19:20:56 +01:00
Anthony Van de Gejuchte 5cd26c005b Add tests 2015-12-18 14:39:48 +01:00
kzc 774bda13cd #873 Fix conditionals optimizations with default compress options 2015-11-24 13:27:50 -05:00
Mihai Bazon 619adb0308 Replace util.error with console.log 2015-11-12 11:47:37 +02:00
kzc bd0ae6569f return undefined optimization no longer uses return_void_0 option 2015-10-29 08:19:12 +01:00
kzc 841a661071 more tests for return undefined optimization 2015-10-29 08:19:12 +01:00
kzc 7491d07666 optimize return undefined and return void 0 2015-10-29 08:19:12 +01:00
Richard van Velzen 335e349314 Allow specification beautify options in tests
Caught an error in #847 as well - `output` wasn't passed anywhere which led to an exception. `options` was available though.
2015-10-28 20:50:01 +01:00
Fábio Santos b5623b19d4 Fix #836 2015-10-20 19:48:56 +01:00
kzc dff54a6552 Fix other operator output related to <!-- or --> 2015-10-13 01:17:10 -04:00
Mihai Bazon 1940fb682c Fix tests 2015-10-12 10:27:00 +03:00
kzc 9f1f21b810 Output -- > instead of --> in expressions. Escape <!-- and --> within string literals. 2015-10-12 10:19:17 +03:00
kzc 0d952ae43d add asm.js test 2015-10-07 10:00:28 +02:00
Mihai Bazon 6637c267a5 Fix mozilla-ast after module loading changes
Need to explicitly qualify stuff now, since it's not evaluated in some
global scope.

Ref #636
2015-09-24 18:13:21 +03:00
Ville Lautanala 5fd12451f9 Control keeping function arguments with a single option 2015-09-14 19:38:45 +02:00
Richard van Velzen fcde6109b0 Fix bad parsing of new new x()() constructs
Fixes #739
2015-08-27 12:29:36 +03:00
Richard van Velzen e3bd223dac Don't change sequences that influence lexical binding in calls
Fixes #782
2015-08-25 10:53:35 +02:00
Christopher Chedeau 3ff0b9e0c9 [Fix] --define replaces SymbolRefs in LHS of assignments
See #208 for context
2015-08-10 11:22:36 -07:00
Richard van Velzen 759b3f7d6d Fix mangling of property names which overwrite unmangleable properties
Fixes #747.
2015-08-05 21:18:39 +02:00
Richard van Velzen f8684f418a Replace util.puts in run-tests with console.log
See d2dda34b2a
2015-07-29 15:24:45 +02:00
Mihai Bazon 905b601178 Don't attempt to negate non-boolean AST_Binary
Fix #751
2015-07-22 16:55:55 +03:00
kzc 9d398d999c spacing 2015-06-14 17:45:19 -04:00
kzc fedb6191a1 optimizations for && and || where left side is constant expression 2015-06-11 23:22:38 -04:00
Mihai Bazon a5b60217ce Fix compressing conditionals
Only transform foo() ? EXP(x) : EXP(y) into EXP(foo() ? x : y) if EXP has no
side effects.

Fix #710
2015-05-18 13:56:04 +03:00
Mihai Bazon 3b14582d6b Fix tests 2015-04-17 11:28:59 +03:00
Fábio Santos de58b0289d Added expect_exact for testing the OutputStream
This works almost exactly like `expect`, except that you pass a literal string
of which the result is compared with the generated output.
2015-04-14 20:26:47 +02:00
Mihai Bazon 18c63ff3d8 Fix compression of conditionals
Don't move the condition on the right side of an assignment when
the left side may have side effects.

Fix #677
2015-04-13 17:29:48 +03:00
Mihai Bazon ecfd881ac6 Keep unused function arguments by default
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-03-20 10:28:51 +02:00
Richard van Velzen 61e850ceb5 Clean up unit test breakage
In 992b6b9fcc unit test broke (which I missed). This was due to undeclared variables not being side-effects free.

However, since they're really not side-effect free, just declare them in the test cases.
2015-02-11 21:27:21 +01:00
Richard van Velzen 992b6b9fcc Fix invalid removal of left side in && and || compression
See #637. This does not produce the optimal result, but it does prevent the removal of non-side-effect-free code.
2015-02-11 21:08:41 +01:00
Richard van Velzen 605362f89d Drop all console statements properly
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-31 13:24:44 +01:00
Mihai Bazon d36067cd35 Merge pull request #615 from avdg/unicode
Give parser more unicode support
2015-01-20 13:00:31 +02:00
Anthony Van de Gejuchte f1b2134dd1 Add test 2015-01-20 00:31:44 +01:00
Tal Ater a1a4c2ada7 Optimize conditionals where the consequent and alternative are both booleans and not equivalent 2015-01-13 18:27:21 +01:00
Richard van Velzen 42ecd42ac0 Replace the correct node when replacing in void sequences
Close #611.
2015-01-12 17:09:34 +01:00