ensure function expression body is a block statement - fixes babel/babel-eslint#20
This commit is contained in:
parent
955dd1e126
commit
9a77a7dbaa
@ -45,11 +45,6 @@ var astTransformVisitor = {
|
||||
delete node.name;
|
||||
}
|
||||
|
||||
if (t.isFunction(node) && node.async) {
|
||||
node.generator = true;
|
||||
node.async - false;
|
||||
}
|
||||
|
||||
if (t.isAwaitExpression(node)) {
|
||||
node.type = "YieldExpression";
|
||||
}
|
||||
@ -98,6 +93,16 @@ var astTransformVisitor = {
|
||||
|
||||
if (t.isArrowFunctionExpression(node)) {
|
||||
node.type = "FunctionExpression";
|
||||
if (node.body.type !== "BlockStatement") {
|
||||
node.body = t.inherits(t.blockStatement([
|
||||
node.body
|
||||
]), node);
|
||||
}
|
||||
}
|
||||
|
||||
if (t.isFunction(node) && node.async) {
|
||||
node.generator = true;
|
||||
node.async - false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user