(
this: Parser,
refExpressionErrors?: ExpressionErrors | null,
)
| 751 | // Parse call, dot, and `[]`-subscript expressions. |
| 752 | // https://tc39.es/ecma262/#prod-LeftHandSideExpression |
| 753 | parseExprSubscripts( |
| 754 | this: Parser, |
| 755 | refExpressionErrors?: ExpressionErrors | null, |
| 756 | ): N.Expression { |
| 757 | const startLoc = this.state.startLoc; |
| 758 | |
| 759 | if ( |
| 760 | refExpressionErrors != null && |
| 761 | (this.match(tt.braceL) || this.match(tt.bracketL)) |
| 762 | ) { |
| 763 | // An object or array literal followed by a subscript can never be |
| 764 | // converted to a pattern, so the errors recorded while parsing it must |
| 765 | // be reported: track them separately to know which ones belong to it. |
| 766 | const atomExpressionErrors = new ExpressionErrors(); |
| 767 | const expr = this.parseExprAtom(atomExpressionErrors); |
| 768 | const result = this.parseSubscripts(expr, startLoc); |
| 769 | if (result !== expr) { |
| 770 | // e.g. `[{ a = 1 }].x = 0` |
| 771 | this.checkExpressionErrors(atomExpressionErrors, true); |
| 772 | } else { |
| 773 | refExpressionErrors.shorthandAssignLoc ??= |
| 774 | atomExpressionErrors.shorthandAssignLoc; |
| 775 | refExpressionErrors.doubleProtoLoc ??= |
| 776 | atomExpressionErrors.doubleProtoLoc; |
| 777 | refExpressionErrors.privateKeyLoc ??= |
| 778 | atomExpressionErrors.privateKeyLoc; |
| 779 | refExpressionErrors.optionalParametersLoc ??= |
| 780 | atomExpressionErrors.optionalParametersLoc; |
| 781 | refExpressionErrors.voidPatternLoc ??= |
| 782 | atomExpressionErrors.voidPatternLoc; |
| 783 | } |
| 784 | return result; |
| 785 | } |
| 786 | |
| 787 | const expr = this.parseExprAtom(refExpressionErrors); |
| 788 | |
| 789 | if (this.shouldExitDescending(expr)) { |
| 790 | return expr; |
| 791 | } |
| 792 | |
| 793 | return this.parseSubscripts(expr, startLoc); |
| 794 | } |
| 795 | |
| 796 | parseSubscripts( |
| 797 | this: Parser, |
nothing calls this directly
no test coverage detected