Fix babel-helper-remap-async-to-generator to not fail with the new validation rules

This commit is contained in:
phantom10111
2015-11-24 22:42:14 +01:00
parent 8186510b5d
commit 615160ba66

View File

@@ -53,6 +53,12 @@ function plainFunction(path: NodePath, callId: Object) {
let asyncFnId = node.id;
node.id = null;
let isDeclaration = path.isFunctionDeclaration();
if (isDeclaration) {
node.type = "FunctionExpression";
}
let built = t.callExpression(callId, [node]);
let container = buildWrapper({
FUNCTION: built,
@@ -61,9 +67,7 @@ function plainFunction(path: NodePath, callId: Object) {
let retFunction = container.body.body[1].argument;
if (path.isFunctionDeclaration()) {
node.type = "FunctionExpression";
if (isDeclaration) {
let declar = t.variableDeclaration("let", [
t.variableDeclarator(
t.identifier(asyncFnId.name),