605 Commits

Author SHA1 Message Date
Amjad Masad
7f4b57a7a4 Add warning instead of removing support 2016-03-10 12:35:15 -08:00
Amjad Masad
342f9d5eb5 Don't consider flow types as bindings 2016-03-10 11:48:14 -08:00
Henry Zhu
0cc53dafc0 add test to npmignores [ci skip] 2016-03-08 22:33:23 -05:00
Amjad Masad
3d5969ecff v6.7.0 2016-03-08 16:52:45 -08:00
Amjad Masad
b35013abe5 Merge pull request #3406 from babel/fix-scope-info
Update scope info after block-scoping transform
2016-03-08 00:57:18 -08:00
Amjad Masad
0200542e82 don't use Array.includes 2016-03-08 00:33:37 -08: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
77c7cc5363 Rework scope info updating in block-scoping transform
I previously tried an approach to scope bindings from var to scope but
it didn't catch all cases. This is evident in this bug:

https://phabricator.babeljs.io/T2892

Where even after transforming a const to a var we still get an error
that it's read-only.

This approach will go through and delete every existing let and const
binding and creates a new one with the kind "var"
2016-03-07 18:19:10 -08:00
Amjad Masad
60d773f370 Merge pull request #3393 from babel/cache
Move NodePath cache out of the AST
2016-03-07 13:57:47 -08:00
Amjad Masad
ec18fa0059 Add clearCache test 2016-03-07 12:50:57 -08:00
Amjad Masad
d5e78384ef Only export methods and not the entire cache 2016-03-07 12:50:29 -08:00
Amjad Masad
fc19ac2af5 Remove merge artificats 2016-03-07 12:05:46 -08:00
Amjad Masad
403d6153fd correct cache path 2016-03-07 12:04:44 -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
3c148148bc Semicolon 2016-03-07 12:04:44 -08:00
Amjad Masad
5367d5d151 Make sure we update the cache in all the right places 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
Henry Zhu
57ef6a2b6a v6.6.5 2016-03-04 18:16:17 -05:00
Amjad Masad
3667527d04 Revert "Remove flow"
This reverts commit 2827ff6b01dcce69e9d3c0402e96b52b3a2a47ee.
2016-03-03 14:49:20 -08:00
Henry Zhu
39a8f5b796 v6.6.4 2016-03-02 16:29:17 -05:00
Sam Goldman
2827ff6b01 Remove flow 2016-03-01 22:33:30 -08:00
Henry Zhu
86284963f3 v6.6.3 2016-03-01 11:40:48 -05:00
Logan Smyth
f2fea017c6 Ensure that the found context is active before pushing it. 2016-03-01 08:14:14 -08:00
Henry Zhu
b1477a3e8c v6.6.2 2016-03-01 09:08:35 -05:00
Logan Smyth
4561732bce Revert .requeue changes made in earlier ES3 fixes. 2016-02-29 23:55:47 -08:00
Henry Zhu
f34e6518ff v6.6.0 2016-02-29 16:12:12 -05: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
f9f8ad6eff v6.5.0 2016-02-06 19:06:41 -05:00
Henry Zhu
c2d7e95e1a add some more flow types 2016-02-04 11:07:03 -05:00
Jason
523a9d1d00 [traverse] nit 2016-02-03 17:46:34 +08:00
Jason
bbdd4aaf21 Ignore isolated paths when traversing 2016-01-23 18:39:14 +08:00
Henry Zhu
e152e7044e v6.4.5 2016-01-19 18:02:31 -05:00
Amjad Masad
1264709226 Merge pull request #3274 from babel/fix-function-decl
Method names should not be bound to body
2016-01-18 10:57:19 -08: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
95c93dd22b Method names should not be bound to body
As an artificat of compiling methods to named function expressions the
function name is being considered a "local" binding in the function
body. This means that we will throw errors anytime someone would want to
create a new local binding with the same name.

This is solved by assigning a symbol to function Identifiers that
indicates that they should not be considered local bindings.
2016-01-17 13:19:37 -08:00
Jordan Klassen
0c1eddfd52 Add documentation comment for visitors.explode 2016-01-14 13:41:19 -08:00
Amjad Masad
ae8b7ea352 v6.3.26 2015-12-22 23:11:59 -08:00
Amjad Masad
6ce463399d Fix evaluation bug with || 2015-12-22 20:48:50 -08:00
Amjad Masad
76eae9bcd8 add failing test 2015-12-22 20:47:08 -08:00
Amjad Masad
705b0959e7 v6.3.25 2015-12-21 13:59:11 -08:00
Amjad Masad
a5b9afbebe Make sure we always return when not confident 2015-12-21 02:04:16 -08:00