| | |
| | | wrapAwait |
| | | }) { |
| | | const argument = path.get("argument"); |
| | | |
| | | if (path.parentPath.isYieldExpression()) { |
| | | path.replaceWith(argument.node); |
| | | return; |
| | | } |
| | | |
| | | path.replaceWith(yieldExpression(wrapAwait ? callExpression(cloneNode(wrapAwait), [argument.node]) : argument.node)); |
| | | } |
| | | |
| | | }; |
| | | |
| | | function _default(path, helpers, noNewArrows) { |
| | | function _default(path, helpers, noNewArrows, ignoreFunctionLength) { |
| | | path.traverse(awaitVisitor, { |
| | | wrapAwait: helpers.wrapAwait |
| | | }); |
| | | const isIIFE = checkIsIIFE(path); |
| | | path.node.async = false; |
| | | path.node.generator = true; |
| | | (0, _helperWrapFunction.default)(path, cloneNode(helpers.wrapAsync), noNewArrows); |
| | | (0, _helperWrapFunction.default)(path, cloneNode(helpers.wrapAsync), noNewArrows, ignoreFunctionLength); |
| | | const isProperty = path.isObjectMethod() || path.isClassMethod() || path.parentPath.isObjectProperty() || path.parentPath.isClassProperty(); |
| | | |
| | | if (!isProperty && !isIIFE && path.isExpression()) { |