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

Function parseDo

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

Source from the content-addressed store, hash-verified

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