57 Commits

Author SHA1 Message Date
Jordan Klassen
dc1f40540d Upgrade to lodash 4 (#3315)
* Upgrade to lodash 4

* Fix incorrect require in babel-runtime/scripts

* Replace cloneDeep with cloneDeepWith where applicable
2016-05-13 17:15:14 -04:00
Logan Smyth
9843c87573 Fix block statement code style. (#3493) 2016-05-02 21:15:37 -04:00
Logan Smyth
bad2c768f2 Remove this check which will never pass with the new cache. 2016-03-23 20:57:18 -07:00
Simeon Willbanks
93d438cf01 Fix misspelling 2016-03-16 22:17:09 -07:00
Logan Smyth
de21f2ef77 Resolve 'arguments' for rest args relative to direct parent. 2016-03-07 20:45:21 -08:00
Logan Smyth
836f398619 Re-use central inShadow logic. 2016-03-07 20:45:19 -08:00
Logan Smyth
8b8e3ddbec Flatten inShadow logic for readability. 2016-03-07 20:45:18 -08:00
Amjad Masad
b53755422c Move things around 2016-03-07 12:04:44 -08:00
Amjad Masad
bf91a68375 Move scope cache to the cache module 2016-03-07 12:04:44 -08:00
Amjad Masad
29ef158204 Semis 2016-03-07 12:03:48 -08:00
Amjad Masad
b9a893aab6 Move NodePath cache out of the AST
As mentioned on the task https://phabricator.babeljs.io/T7179 having
this cache on the AST leads to all sorts of portability and reuse
bugs.

This moves the cache into a clearable WeakMap which will fix the
following:

1. Moving the AST between different babel versions or tools will not
lead into sharing potentially outdated cached information

2. `.clear()` can be called on the cache by a plugin to clear
potentially outdated information. This is helpful when implementing two
seperate pipelines that should not share information.

I think the next step (which is harder, I tried) is to isolate cache and
make it live on a transform or pipeline level state (like the `hub`).

The reason it is hard is because the `babel-traverse` main API -- although
requires the state object to be passed -- not many callers do. To fix
this we should release a patch version that warns about this and fix all
the internal callers. Next couple of releases we can start throwing when
no state is passed (or we can create our own state).
2016-03-07 12:03:48 -08:00
Amjad Masad
3667527d04 Revert "Remove flow"
This reverts commit 2827ff6b01dcce69e9d3c0402e96b52b3a2a47ee.
2016-03-03 14:49:20 -08:00
Sam Goldman
2827ff6b01 Remove flow 2016-03-01 22:33:30 -08:00
Logan Smyth
f2fea017c6 Ensure that the found context is active before pushing it. 2016-03-01 08:14:14 -08:00
Logan Smyth
4561732bce Revert .requeue changes made in earlier ES3 fixes. 2016-02-29 23:55:47 -08:00
Henry Zhu
b8cdd6e28c Merge pull request #3365 from jridgewell/replace-implicit-arrow-with-block
Replace arrow expression body with block statement
2016-02-25 22:02:31 -05:00
Logan Smyth
01003b954a Re-queue nodes inserted with .replaceWith and centralize logic - fixes T2817 2016-02-22 22:44:03 -08:00
Justin Ridgewell
de1431e8c6 Replace arrow expression body with block statement
Original PR: https://github.com/babel/babel/pull/2469. Seems this got
lost in the v6 changes.

- - -

Without this, the only way to replace the arrow function is to either
manually override its `node.body`, or duplicate the arrow:

```js
// Old
ArrowFunctionExpression: function (node) {
  node.body = t.blockStatement(...);
  // Or
  return t.ArrowFunctionExpression(
    node.params,
    t.blockStatement(...),
    node.async
  );
}

// New
ArrowFunctionExpression: function() {
  this.get("body").replaceWith(t.blockStatement(...));
}
```
2016-02-20 04:36:40 -05:00
Logan Smyth
39c9066e40 Merge pull request #3359 from loganfsmyth/context-queueing-order
Queue regeneratorRuntime so it is transformed before Program#exit
2016-02-15 21:23:45 -08:00
Sebastian McKenzie
5b89849f43 Switch to klint, fix some lint rules 2016-02-14 23:25:14 +00:00
Logan Smyth
96a6d9f92e Queue regeneratorRuntime so it is transformed before Program#exit - fixes T7041 2016-02-13 22:56:03 -08:00
Henry Zhu
c2d7e95e1a add some more flow types 2016-02-04 11:07:03 -05:00
Henry Zhu
51dfd2237e Internal: temporarily remove flow types
- Will need to investigate the issue regarding eslint/babel-eslint.
2016-01-17 17:14:57 -05:00
Amjad Masad
6ce463399d Fix evaluation bug with || 2015-12-22 20:48:50 -08:00
Amjad Masad
a5b9afbebe Make sure we always return when not confident 2015-12-21 02:04:16 -08:00
Amjad Masad
57b2ccdb66 Test and workaround inference bugs 2015-12-18 03:15:27 -08:00
Sebastian McKenzie
a8a58aaa07 Fix infinite recursion bug 2015-12-17 14:44:18 +00:00
Logan Smyth
05fc7ee05b Merge pull request #3137 from loganfsmyth/export-all-fail-T2763
Set the proper parents for new node paths - fixes T2763
2015-12-06 22:15:46 -08:00
Henry Zhu
d06cfe63c2 eslint: add space-after-keywords 2015-12-06 11:30:07 -05:00
Amjad Masad
350ee82a83 add comment 2015-12-06 08:00:15 -08:00
Amjad Masad
036e90e9cc Fix bug with evaluating an expression in it's own binding 2015-12-06 07:56:17 -08:00
Logan Smyth
f37acd293c Set the proper parents for new node paths - fixes T2763 2015-12-05 16:16:02 -08:00
Daniel Lo Nigro
0076204f80 Fix Flow.
Removed `@flow` annotation from files that don't actually pass Flow check at the moment. These will be added back file by file once the files are properly converted to use Flow.

Closes #3064
2015-11-15 21:30:22 -08:00
Sebastian McKenzie
688dcec6a3 fix queueing of nested paths being pushed onto the priority queue 2015-11-13 03:37:15 -08:00
Amjad Masad
46d8241caf Use node for parent check 2015-11-11 13:30:45 -08:00
Sebastian McKenzie
0869d321b4 clean up _verifyNodeList error messages 2015-11-08 05:33:51 -08:00
Sebastian McKenzie
f4fe578a6c add node existence check to NodePath#has - fixes #2800 2015-11-04 23:38:14 +00:00
Sebastian McKenzie
59ecfecb9e fix indentation and skip check for references that are inside the function we're checking execution status against 2015-11-03 04:17:38 +00:00
Sebastian McKenzie
e62a00df50 rename NumberLiteral to NumericLiteral and RegexLiteral to RegExpLiteral 2015-11-03 01:19:35 +00:00
Sebastian McKenzie
d1d0ed901e fix export of parameters when renaming the binding of exported functions - fixes #2753 2015-11-02 19:24:23 +00:00
Sebastian McKenzie
6ccee750e3 check for path existence before checking that it's the correct instance 2015-11-02 06:42:48 +00:00
Sebastian McKenzie
24f5ef50b0 when we encounter a different NodePath instance, ignore it and create a new one. this is going to thrash the tree and memory but npm and node module resolution is atrociously bad 2015-11-02 06:36:07 +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
6740561f91 remove comments from old node after inheriting from new one when replacing nodes - closes #2490, closes #2489 2015-10-05 16:27:17 +01:00
Sebastian McKenzie
0708edb927 it's now safe to use path.remove() 2015-09-18 18:41:44 +01:00
Sebastian McKenzie
6898cf83d0 don't allow visitor methods to return a new node to replace 2015-09-15 06:27:37 +01:00
Sebastian McKenzie
13773e3c02 change traversal visitor method signature from (node, parent, scope, state) to (path, state) 2015-09-15 06:27:19 +01:00
Sebastian McKenzie
68e1a442c5 don't deopt _guessExecutionStatusRelativeTo on specific function cases 2015-09-01 05:00:14 +01:00
Sebastian McKenzie
1895ee02b5 add Path#isStatic 2015-09-01 04:59:52 +01:00
Sebastian McKenzie
59f71a3a09 add validation to babel-types - fixes #1858 2015-09-01 04:58:11 +01:00