add @danez's changes
This commit is contained in:
parent
2b9c3735fd
commit
b363e7b199
@ -6,6 +6,7 @@ packages/*/node_modules
|
|||||||
packages/*/lib
|
packages/*/lib
|
||||||
packages/*/dist
|
packages/*/dist
|
||||||
packages/*/test/fixtures
|
packages/*/test/fixtures
|
||||||
|
packages/*/test/tmp
|
||||||
vendor
|
vendor
|
||||||
_babel.github.io
|
_babel.github.io
|
||||||
Gulpfile.js
|
Gulpfile.js
|
||||||
|
|||||||
@ -146,6 +146,23 @@ function plainFunction(path: NodePath, callId: Object) {
|
|||||||
]);
|
]);
|
||||||
declar._blockHoist = true;
|
declar._blockHoist = true;
|
||||||
|
|
||||||
|
if (path.parentPath.isExportDefaultDeclaration()) {
|
||||||
|
// change the path type so that replaceWith() does not wrap
|
||||||
|
// the identifier into an expressionStatement
|
||||||
|
path.parentPath.insertBefore(declar);
|
||||||
|
path.parentPath.replaceWith(
|
||||||
|
t.exportNamedDeclaration(null,
|
||||||
|
[
|
||||||
|
t.exportSpecifier(
|
||||||
|
t.identifier(asyncFnId.name),
|
||||||
|
t.identifier("default")
|
||||||
|
)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
path.replaceWith(declar);
|
path.replaceWith(declar);
|
||||||
} else {
|
} else {
|
||||||
const retFunction = container.body.body[1].argument;
|
const retFunction = container.body.body[1].argument;
|
||||||
|
|||||||
@ -0,0 +1 @@
|
|||||||
|
export default async () => { return await foo(); }
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = babelHelpers.asyncToGenerator(function* () {
|
||||||
|
return yield foo();
|
||||||
|
});
|
||||||
@ -0,0 +1 @@
|
|||||||
|
export default async function myFunc() {}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
let myFunc = (() => {
|
||||||
|
var _ref = babelHelpers.asyncToGenerator(function* () {});
|
||||||
|
|
||||||
|
return function myFunc() {
|
||||||
|
return _ref.apply(this, arguments);
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
|
||||||
|
exports.default = myFunc;
|
||||||
Loading…
x
Reference in New Issue
Block a user