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

Function parseExprList

packages/babel-parser/src/parser/expression.ts:2736–2763  ·  view source on GitHub ↗
(
    this: Parser,
    close: TokenType,
    allowEmpty?: boolean,
    refExpressionErrors?: ExpressionErrors | null,
    nodeForExtra?: Undone<N.Node> | null,
  )

Source from the content-addressed store, hash-verified

2734 // for array literals).
2735 // https://tc39.es/ecma262/#prod-ElementList
2736 parseExprList(
2737 this: Parser,
2738 close: TokenType,
2739 allowEmpty?: boolean,
2740 refExpressionErrors?: ExpressionErrors | null,
2741 nodeForExtra?: Undone<N.Node> | null,
2742 ): (N.Expression | null)[] {
2743 const elts: (N.Expression | null)[] = [];
2744 let first = true;
2745
2746 while (!this.eat(close)) {
2747 if (first) {
2748 first = false;
2749 } else {
2750 this.expect(tt.comma);
2751 if (this.match(close)) {
2752 if (nodeForExtra) {
2753 this.addTrailingCommaExtraToNode(nodeForExtra);
2754 }
2755 this.next();
2756 break;
2757 }
2758 }
2759
2760 elts.push(this.parseExprListItem(close, allowEmpty, refExpressionErrors));
2761 }
2762 return elts;
2763 }
2764
2765 parseExprListItem(
2766 this: Parser,

Callers

nothing calls this directly

Calls 3

matchMethod · 0.80
nextMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected