11 Commits

Author SHA1 Message Date
Logan Smyth
79b2af5997
Format fixture JSON with Prettier. (#8658) 2018-09-09 17:57:52 -07:00
Justin Ridgewell
e229ebbb8a
Optimize async to generator (#8267)
* Optimize async to generator

We can reuse the step function, avoiding a closure on every invocation.

* Rename step
2018-07-05 10:51:16 -04:00
Nicolò Ribaudo
8659e1a88c Remove old expected.{js,json} files (#7187) 2018-01-09 13:10:30 -06:00
Raja Sekar
0f42accb87 Renamed files 2018-01-09 15:36:42 +01: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
Satyajit Sahoo
7ae6e1e5a0 Add /*#__PURE__*/ annotatiotion for babel-plugin-async-to-generator. Fixes #6572 2017-11-12 18:31:48 +05:30
Mateusz Burzyński
88b7983e4f Fixed asyncToGenerator helper using arrow function (#6289) 2017-09-21 17:09:43 -07: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
Steven Hargrove
d5aa6d3ff8 Fix for #4943 "Calling an async function with default parameter as function for arguments checking handled synchonous" (#5688)
* moved applying arguments inside new Promise handler block

* updated test fixture to reflect change

* corrected the apply to use correct scope and arguments

* added regression test for issue #4943, added async-to-generator/async-default-arguments test

* added regression test for issue #4943

* switched back to using arrow function, since now pointing to v7 release base branch

* simplified async-to-generator regression test for issue #4943, imrproved change to self/arguments refs by using arrow function on returned promise

* updated text fixtures

* removed es2015 preset usage from issue #4943 regression exec test

* added use strict to test fixture

* added use strict to test fixture

* added destructing transform to test options

* removed use strict from exec test

* added parameters & destructing transforms to test
2017-05-03 21:44:41 -07:00
Henry Zhu
2a874dff8c fix the fixtures after PR was merged 2017-04-06 14:14:15 -04:00
Diogo Franco
452f8f150c Always use the native (or polyfilled) Promise in transform-async-to-generator (#5536)
* Always use the native (or polyfilled) Promise in transform-async-to-generator

Fixes #5531

* Simplify scope handling to only un-shadow the Program's Promise

Only the helper needs to see the native Promise.
2017-04-06 11:17:31 -04:00