186 Commits

Author SHA1 Message Date
Gvozd
653318b7e4 Always transform for-await in async functions. (#7446)
for-await was transformed in @babel/helper-remap-async-to-generator, which was
called by @babel/plugin-transform-async-to-generator and
@babel/plugin-proposal-async-generator-functions. This prevented for-await
statements in async functions to be transpiled if the
transform-async-to-generator plugin was't enabled.
2018-03-05 09:30:25 +01:00
Henry Zhu
ea3f2d9299 v7.0.0-beta.40 2018-02-12 11:41:13 -05:00
Henry Zhu
73e64c6cb0 v7.0.0-beta.39 2018-01-30 15:27:19 -05:00
Nicolò Ribaudo
252ea5a966 Fix reused nodes - part 2 (#7149) 2018-01-29 22:59:06 +01:00
Henry Zhu
b5d20ab171 v7.0.0-beta.38 2018-01-17 11:31:32 -05:00
Henry Zhu
7c99f4653f v7.0.0-beta.37 2018-01-08 11:02:14 -05:00
Diogo Franco
0f60d42fdf
Avoid adding #__PURE__ annotation to .bind(this)() expressions (#7043)
* Avoid adding #__PURE__ annotation to .bind(this)() expressions

Fixes the #__PURE__ annotation getting added to (async () => {})() IIFEs when the arrow function transform is running with spec: true.

* Return false instead of undefined

* Fix indentation in json files

* Add one more case to the async-iife fixtures
2017-12-28 17:02:54 +09:00
Henry Zhu
7d798952d2 v7.0.0-beta.36 2017-12-25 14:04:08 -05:00
Henry Zhu
8a4124b2ff v7.0.0-beta.35 2017-12-14 16:47:27 -05:00
Nicolò Ribaudo
05b22d2597
Update @babel/helper-wrap-function templates (#6984)
This commit introduces 4 changes:

1) Function declarations are wrapped using function declarations.
   This has two advantages:
    - We can rely on native hoisting, instead of using _blockHoist
    - The function isn't wrapped until it is called. This avoids
      problems where `regeneratorRuntime.wrap` was called before
      that `babel-polyfill` was imported.

   Example:
     function fn() {}
     // becomes
     function fn() { return _fn.apply(this, arguments); }
     function _fn() {
       _fn = _wrapper(/* Original function ... */);
       return _fn.apply(this, arguments);
     }

2) Use a single template for both named and anonymous function
   expressions. They already had the same behavior, but the one
   used for named functions was a bit longer.

3) Use normal functions instead of arrow functions to wrap
   function expressions.

4) Generate a name based on the original one for wrapped
   functions (e.g. `foo` becomes `_foo` instead of `_ref`).
2017-12-13 16:21:58 +01:00
Diogo Franco
82357d79a7 Workaround bad #__PURE__ annotation placement on IIFEs (#6999)
Based on a fix suggested by @kzc
2017-12-08 09:51:48 -05:00
Henry Zhu
a7c9264c79 v7.0.0-beta.34 2017-12-02 09:38:52 -05:00
Henry Zhu
413aa79711 v7.0.0-beta.33 2017-12-01 09:27:57 -05:00
Sven SAULEAU
42c740ca0a
Merge branch 'master' into async-to-generator-pure 2017-11-13 11:49:16 +01:00
Henry Zhu
4e6cd298c7 v7.0.0-beta.32 2017-11-12 08:32:53 -05:00
Satyajit Sahoo
7ae6e1e5a0 Add /*#__PURE__*/ annotatiotion for babel-plugin-async-to-generator. Fixes #6572 2017-11-12 18:31:48 +05:30
Henry Zhu
f76ac0b197 v7.0.0-beta.31 2017-11-03 16:03:01 -04:00
Henry Zhu
690d6465d8 v7.0.0-beta.5 2017-10-30 16:55:46 -04:00
Henry Zhu
38f984f956 v7.0.0-beta.4 2017-10-30 14:33:56 -04:00
Mateusz Burzyński
4684edaec7 Adhering to async generator yield behavior change (#6452) 2017-10-21 21:48:27 +02:00
Logan Smyth
afc3963848 Clean up template calls. 2017-10-18 13:55:14 -07:00
Henry Zhu
c0a958098f Scoped: update readme headers to @babel/ [skip ci] 2017-10-16 22:49:57 -04:00
Henry Zhu
cde0054227 Scoped: change src imports to @babel/ [skip ci] 2017-10-16 22:49:56 -04:00
Henry Zhu
8e5e27577a Scoped: update package.json dependencies to @babel/ [skip ci] 2017-10-16 22:49:56 -04:00
Henry Zhu
1cd564bd16 Scoped: rename package names to @babel/ [skip ci] 2017-10-16 22:49:01 -04:00
Henry Zhu
94da889ab7 v7.0.0-beta.3 2017-10-15 09:12:00 -04:00
Mateusz Burzyński
e52f6caa18 Drop old compatibility if statement targeting babel@6.15 and earlier (#6451) 2017-10-09 13:49:06 -04:00
Henry Zhu
70547efcc1 v7.0.0-beta.2 2017-09-26 11:14:41 -04:00
Henry Zhu
23121d2bd3 v7.0.0-beta.1 2017-09-19 16:24:07 -04:00
Henry Zhu
1c13250807 v7.0.0-beta.0 2017-09-11 23:01:41 -04:00
Henry Zhu
b82b65a31e v7.0.0-alpha.20 2017-08-30 15:02:49 -04:00
Artem Yavorsky
b2b3d7944a Spec compatibility for iteratorClose condition. (#6094)
* for-of: IteratorClose spec compatibility.

See #3:
https://tc39.github.io/ecma262/#sec-iteratorclose

* Update spec fixtures for for-of.

* Fix IteratorClose case for remap-async-to-generator.

* Fix IteratorClose case for async-generator-function test output.

* Modify few tests according to iteratorClose fix.

* Fix iteratorClose for helpers.slicedToArray also.

* Update iteratorClose fixture for commonjs.
2017-08-28 13:39:02 -06:00
Henry Zhu
79f4956948 v7.0.0-alpha.19 2017-08-07 18:21:08 -04:00
Henry Zhu
79c6814d65 v7.0.0-alpha.18 2017-08-03 18:20:36 -04:00
Henry Zhu
9322fd0458 v7.0.0-alpha.17 2017-07-26 08:38:44 -04:00
Henry Zhu
7f1cd44d60 v7.0.0-alpha.16 2017-07-25 17:35:35 -04:00
Nicolò Ribaudo
fb9a752262 Function sent (#5920)
* Create "babel-helper-wrap-function"

It contains the logic to wrap a function inside a call expression.
It was part of the "babel-helper-remap-async-to-generator" package, but
it is needed to transpile "function.sent"

* Create "babel-transform-function-sent"

It transforms the "function.sent" meta property by replacing it with
"yield" and making the generator ignore the first ".next()" call.

* "function.sent" is the last value passed to .next(), not the first one

* Disable exec tests on old node

* Fix flow error

* Add "transform-function-sent" to "stage-2" preset

* Do every trasformation in one traversal

* Test for "yield function.sent"

* [skip ci]

* Fix some typos [skip ci]
2017-07-25 11:07:01 -04:00
Henry Zhu
a0f0411abf v7.0.0-alpha.15 2017-07-11 23:35:22 -04:00
Henry Zhu
03f249430a v7.0.0-alpha.14 2017-07-11 22:53:09 -04:00
Henry Zhu
8460b4c62f v7.0.0-alpha.13 2017-07-11 22:27:56 -04:00
Justin Ridgewell
51ff4dd936 Fix async-to-generator ForAwait transform (#5932)
The old transform called an external `babel-traverse`, which doesn’t
does something funky.
2017-07-09 23:49:44 -05:00
Brian Ng
e4b35f680d
Run prettier 2017-06-27 12:15:00 -05:00
Henry Zhu
c5bad22767 v7.0.0-alpha.12 2017-05-31 17:11:39 -04:00
Henry Zhu
ce976bba2a v7.0.0-alpha.11 2017-05-31 16:43:30 -04:00
Henry Zhu
9b44cef691 v7.0.0-alpha.10 2017-05-25 15:17:07 -04: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
Henry Zhu
62375cdf12 v7.0.0-alpha.9 2017-04-18 10:41:30 -04:00
Henry Zhu
25ae8c8554 v7.0.0-alpha.8 2017-04-17 15:12:31 -04:00
Henry Zhu
c732f5e1d0 v7.0.0-alpha.7 2017-04-05 17:13:26 -04:00
Henry Zhu
7a1ccf076c Misc (#5545)
* normalize npmignores

* fixup eslint ignore, etc

* lint

* remove unused

* rm from gitignore

* use strict
2017-03-25 21:46:16 -04:00