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

Function parseDo

packages/babel-parser/src/parser/expression.ts:1570–1597  ·  view source on GitHub ↗
(
    this: Parser,
    node: Undone<N.DoExpression>,
    isAsync: boolean,
  )

Source from the content-addressed store, hash-verified

1568 // https://github.com/tc39/proposal-do-expressions
1569 // https://github.com/tc39/proposal-async-do-expressions
1570 parseDo(
1571 this: Parser,
1572 node: Undone<N.DoExpression>,
1573 isAsync: boolean,
1574 ): N.DoExpression {
1575 this.expectPlugin("doExpressions");
1576 if (isAsync) {
1577 this.expectPlugin("asyncDoExpressions");
1578 }
1579 node.async = isAsync;
1580 this.next(); // eat `do`
1581 const oldLabels = this.state.labels;
1582 this.state.labels = [];
1583 if (isAsync) {
1584 // AsyncDoExpression :
1585 // async [no LineTerminator here] do Block[~Yield, +Await, ~Return]
1586 this.expressionScope.enter(sharedExpressionScope);
1587 this.prodParam.enter(ParamKind.PARAM_AWAIT);
1588 node.body = this.parseBlock();
1589 this.prodParam.exit();
1590 this.expressionScope.exit();
1591 } else {
1592 node.body = this.parseBlock();
1593 }
1594
1595 this.state.labels = oldLabels;
1596 return this.finishNode(node, "DoExpression");
1597 }
1598
1599 // Parse the `super` keyword
1600 parseSuper(): N.Super {

Callers

nothing calls this directly

Calls 5

nextMethod · 0.80
parseBlockMethod · 0.80
finishNodeMethod · 0.80
enterMethod · 0.45
exitMethod · 0.45

Tested by

no test coverage detected