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

Function parseSubscripts

packages/babel-parser/src/parser/expression.ts:814–832  ·  view source on GitHub ↗
(
    this: Parser,
    base: N.Expression | N.Super | N.Import,
    startLoc: Position,
    noCalls?: boolean | null,
  )

Source from the content-addressed store, hash-verified

812 noCalls?: boolean | null,
813 ): N.Expression | N.Super | N.Import;
814 parseSubscripts(
815 this: Parser,
816 base: N.Expression | N.Super | N.Import,
817 startLoc: Position,
818 noCalls?: boolean | null,
819 ) {
820 const state = {
821 optionalChainMember: false,
822 maybeAsyncArrow: this.atPossibleAsyncArrow(base),
823 stop: false,
824 };
825 do {
826 base = this.parseSubscript(base, startLoc, noCalls, state);
827
828 // After parsing a subscript, this isn't "async" for sure.
829 state.maybeAsyncArrow = false;
830 } while (!state.stop);
831 return base;
832 }
833
834 /**
835 * @param state Set 'state.stop = true' to indicate that we should stop parsing subscripts.

Callers

nothing calls this directly

Calls 2

atPossibleAsyncArrowMethod · 0.80
parseSubscriptMethod · 0.45

Tested by

no test coverage detected