()
| 5218 | } |
| 5219 | |
| 5220 | func (p *Parser) parseSuperExpression() *ast.Expression { |
| 5221 | pos := p.nodePos() |
| 5222 | expression := p.parseKeywordExpression() |
| 5223 | if p.token == ast.KindLessThanToken { |
| 5224 | startPos := p.nodePos() |
| 5225 | typeArguments := p.tryParseTypeArgumentsInExpression() |
| 5226 | if typeArguments != nil { |
| 5227 | p.parseErrorAt(startPos, p.nodePos(), diagnostics.X_super_may_not_use_type_arguments) |
| 5228 | if !p.isTemplateStartOfTaggedTemplate() { |
| 5229 | expression = p.finishNode(p.factory.NewExpressionWithTypeArguments(expression, typeArguments), pos) |
| 5230 | } |
| 5231 | } |
| 5232 | } |
| 5233 | if p.token == ast.KindOpenParenToken || p.token == ast.KindDotToken || p.token == ast.KindOpenBracketToken { |
| 5234 | return expression |
| 5235 | } |
| 5236 | // If we have seen "super" it must be followed by '(' or '.'. |
| 5237 | // If it wasn't then just try to parse out a '.' and report an error. |
| 5238 | p.parseErrorAtCurrentToken(diagnostics.X_super_must_be_followed_by_an_argument_list_or_member_access) |
| 5239 | // private names will never work with `super` (`super.#foo`), but that's a semantic error, not syntactic |
| 5240 | return p.finishNode(p.factory.NewPropertyAccessExpression(expression, nil /*questionDotToken*/, p.parseRightSideOfDot(true /*allowIdentifierNames*/, true /*allowPrivateIdentifiers*/, true /*allowUnicodeEscapeSequenceInIdentifierName*/), ast.NodeFlagsNone), pos) |
| 5241 | } |
| 5242 | |
| 5243 | func (p *Parser) isTemplateStartOfTaggedTemplate() bool { |
| 5244 | return p.token == ast.KindNoSubstitutionTemplateLiteral || p.token == ast.KindTemplateHead |
no test coverage detected