* Don't use args rest/spread to hoist super method calls
* Hoist this in hoisted super method calls
* Make the code more readable
Review by edoardocavazza
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.
* 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
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`).
* 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.
* Remove whitespace generation and rely on default printing
Changes to printing:
* Add newline after last empty SwitchCase
* Add newlines around block comments if they are non-flow comments or contain newlines
* Fix a few more fixtures
* 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.
* 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
* 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.