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

Function parseUpdate

packages/babel-parser/src/parser/expression.ts:733–749  ·  view source on GitHub ↗
(
    this: Parser,
    refExpressionErrors?: ExpressionErrors | null,
  )

Source from the content-addressed store, hash-verified

731
732 // https://tc39.es/ecma262/#prod-UpdateExpression
733 parseUpdate(
734 this: Parser,
735 refExpressionErrors?: ExpressionErrors | null,
736 ): N.Expression {
737 const startLoc = this.state.startLoc;
738 let expr = this.parseExprSubscripts(refExpressionErrors);
739 if (this.checkExpressionErrors(refExpressionErrors, false)) return expr;
740 while (tokenIsPostfix(this.state.type) && !this.canInsertSemicolon()) {
741 const node = this.startNodeAt<N.UpdateExpression>(startLoc);
742 node.operator = this.state.value;
743 node.prefix = false;
744 node.argument = expr as N.UpdateExpression["argument"];
745 this.next();
746 this.checkLVal(expr, (expr = this.finishNode(node, "UpdateExpression")));
747 }
748 return expr;
749 }
750
751 // Parse call, dot, and `[]`-subscript expressions.
752 // https://tc39.es/ecma262/#prod-LeftHandSideExpression

Callers

nothing calls this directly

Calls 3

tokenIsPostfixFunction · 0.90
nextMethod · 0.80
finishNodeMethod · 0.80

Tested by

no test coverage detected