17 Commits

Author SHA1 Message Date
Mateusz Burzyński
413ffe6639 Extracted babel-helper-annotate-as-pure (#6267) 2017-09-25 17:40:51 +02:00
Justin Ridgewell
4daf11528c Return inserted/replaced paths (#5710)
* Return inserted/replaced paths

This gives `Path`’s replacement and insertion methods a consistent
return value: the inserted/replaced paths.

Before, they could return `undefined`, a `node`, or a the current path
inside an array. It was kinda pointless.  But now they always return an
array of paths, which is useful for solving
https://github.com/babel/babel/pull/4935#discussion_r96151368.

* Return inserted nodes and not BlockStatement

Addded test for bug #4363

* Cleanups

- `#replaceWith` will now return the current path if it's the same node
- `#insertAfter` and `#insertBefore` use public Path APIs now
- Makes container insertion faster (single splice call)
- Use public APIs in container insertion
- Replacing a statement with an expression returns the expression's path
- Replacing an expression with multiple statements returns the inserted
  closure's body's paths.
2017-09-11 16:07:04 -04:00
Mateusz Burzyński
c47258d68c Annotating transformed classes with #__PURE__ comment (#6209) 2017-09-11 11:18:37 -04:00
Brian Ng
e4b35f680d
Run prettier 2017-06-27 12:15:00 -05:00
Logan Smyth
14584c218c Kill the "shadow-functions.js" internal plugin in favor of an explicit helper (#5677)
* Handle arrow function processing via shared API rather than default plugin.

* Fix a few small PR comments.

* Preserve existing spec arrow 'this' rewrites, and support spec in subclass constructors.
2017-05-05 13:27:18 -07:00
Brian Ng
cd9bb7ba10 Ensure default exported classes keep entry in export table (#5488) 2017-04-09 16:39:15 -07:00
Brian Ng
8a82cc060a Run new lint rules (#5413) 2017-03-04 10:46:01 -05:00
Henry Zhu
672adba9a1 enable prefer const (#5113) 2017-01-14 09:48:52 -05:00
Logan Smyth
9843c87573 Fix block statement code style. (#3493) 2016-05-02 21:15:37 -04:00
Logan Smyth
b3f2ea0aa1 Avoid duplicating traversal of class declarations - fixes T2694 2015-11-19 00:30:56 -08:00
Sebastian McKenzie
01356191d4 avoid revisiting classes - #2694 2015-11-13 16:55:54 -08:00
Sebastian McKenzie
fc0baf1e2c Merge pull request #2841 from hzoo/i-2694
transform-es2015-classes: check if node.id is null
2015-11-05 17:09:50 +00:00
Henry Zhu
f1a62ef078 transform-es2015-classes: check if node.id is null 2015-11-05 10:25:56 -05:00
Sebastian McKenzie
1bfb7039e9 protect against replacing a class expression with itself when attempting to infer a new function name - fixes #2803 2015-11-04 23:34:33 +00:00
Sebastian McKenzie
231017d3ae return -> path.replaceWith - fixes #2699 2015-10-31 06:13:42 +00:00
Sebastian McKenzie
ae7d5367f1 6.0.0
I'm extremely stupid and didn't commit as I go. To anyone reading this
I'm extremely sorry. A lot of these changes are very broad and I plan on
releasing Babel 6.0.0 today live on stage at Ember Camp London so I'm
afraid I couldn't wait. If you're ever in London I'll buy you a beer
(or assorted beverage!) to make up for it, also I'll kiss your feet and
give you a back massage, maybe.
2015-10-29 17:51:24 +00:00
Sebastian McKenzie
9969224a93 add more plugins, rename some 2015-09-15 06:12:46 +01:00