MCPcopy Create free account
hub / github.com/babel/babel / parseAsyncArrowUnaryFunction

Function parseAsyncArrowUnaryFunction

packages/babel-parser/src/parser/expression.ts:1553–1568  ·  view source on GitHub ↗
(
    this: Parser,
    node: Undone<N.ArrowFunctionExpression>,
  )

Source from the content-addressed store, hash-verified

1551
1552 // async [no LineTerminator here] AsyncArrowBindingIdentifier[?Yield] [no LineTerminator here] => AsyncConciseBody[?In]
1553 parseAsyncArrowUnaryFunction(
1554 this: Parser,
1555 node: Undone<N.ArrowFunctionExpression>,
1556 ): N.ArrowFunctionExpression {
1557 // We don't need to push a new ParameterDeclarationScope here since we are sure
1558 // 1) it is an async arrow, 2) no biding pattern is allowed in params
1559 this.prodParam.enter(functionFlags(true, this.prodParam.hasYield));
1560 const params = [this.parseIdentifier()];
1561 this.prodParam.exit();
1562 if (this.hasPrecedingLineBreak()) {
1563 this.raise(Errors.LineTerminatorBeforeArrow, this.state.curPosition());
1564 }
1565 this.expect(tt.arrow);
1566 // let foo = async bar => {};
1567 return this.parseArrowExpression(node, params, true);
1568 }
1569
1570 // https://github.com/tc39/proposal-do-expressions
1571 // https://github.com/tc39/proposal-async-do-expressions

Callers

nothing calls this directly

Calls 6

functionFlagsFunction · 0.90
parseIdentifierMethod · 0.80
curPositionMethod · 0.80
parseArrowExpressionMethod · 0.80
enterMethod · 0.45
exitMethod · 0.45

Tested by

no test coverage detected