Fix bodyless async functions (#4600)

* fix bodyless async functions (#4599)

* Do the same in the async-generator-functions transform
This commit is contained in:
Dan Harper 2016-09-29 11:01:37 +01:00 committed by Daniel Tschinder
parent 6d82ee297e
commit 682e9658c9
4 changed files with 12 additions and 2 deletions

View File

@ -152,7 +152,7 @@ function plainFunction(path: NodePath, callId: Object) {
}
export default function (path: NodePath, file: Object, helpers: Object) {
path.get("body").traverse(awaitVisitor, {
path.traverse(awaitVisitor, {
file,
wrapAwait: helpers.wrapAwait
});

View File

@ -22,7 +22,7 @@ export default function ({ types: t }) {
Function(path, state) {
if (!path.node.async || !path.node.generator) return;
path.get("body").traverse(yieldStarVisitor, state);
path.traverse(yieldStarVisitor, state);
remapAsyncToGenerator(path, state.file, {
wrapAsync: t.memberExpression(

View File

@ -0,0 +1,3 @@
async () => await promise
async () => { await promise }

View File

@ -0,0 +1,7 @@
babelHelpers.asyncToGenerator(function* () {
return yield promise;
});
babelHelpers.asyncToGenerator(function* () {
yield promise;
});