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

Function parseAsyncArrowUnaryFunction

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

Source from the content-addressed store, hash-verified

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