| 2735 | // for array literals). |
| 2736 | // https://tc39.es/ecma262/#prod-ElementList |
| 2737 | parseExprList( |
| 2738 | this: Parser, |
| 2739 | close: TokenType, |
| 2740 | allowEmpty?: boolean, |
| 2741 | refExpressionErrors?: ExpressionErrors | null, |
| 2742 | nodeForExtra?: Undone<N.Node> | null, |
| 2743 | ): (N.Expression | null)[] { |
| 2744 | const elts: (N.Expression | null)[] = []; |
| 2745 | let first = true; |
| 2746 | |
| 2747 | while (!this.eat(close)) { |
| 2748 | if (first) { |
| 2749 | first = false; |
| 2750 | } else { |
| 2751 | this.expect(tt.comma); |
| 2752 | if (this.match(close)) { |
| 2753 | if (nodeForExtra) { |
| 2754 | this.addTrailingCommaExtraToNode(nodeForExtra); |
| 2755 | } |
| 2756 | this.next(); |
| 2757 | break; |
| 2758 | } |
| 2759 | } |
| 2760 | |
| 2761 | const elt = this.parseExprListItem( |
| 2762 | close, |
| 2763 | allowEmpty, |
| 2764 | refExpressionErrors, |
| 2765 | ); |
| 2766 | // On invalid input `new f(,)` in errorRecovery mode, |
| 2767 | // do not leave a hole in the arguments list |
| 2768 | if (elt !== null || allowEmpty) elts.push(elt); |
| 2769 | } |
| 2770 | return elts; |
| 2771 | } |
| 2772 | |
| 2773 | parseExprListItem( |
| 2774 | this: Parser, |