(modifiers *ast.ModifierList)
| 3366 | } |
| 3367 | |
| 3368 | func (p *Parser) parseNameOfParameter(modifiers *ast.ModifierList) *ast.Node { |
| 3369 | // FormalParameter [Yield,Await]: |
| 3370 | // BindingElement[?Yield,?Await] |
| 3371 | name := p.parseIdentifierOrPatternWithDiagnostic(diagnostics.Private_identifiers_cannot_be_used_as_parameters) |
| 3372 | if name.Loc.Len() == 0 && modifiers == nil && ast.IsModifierKind(p.token) { |
| 3373 | // in cases like |
| 3374 | // 'use strict' |
| 3375 | // function foo(static) |
| 3376 | // isParameter('static') == true, because of isModifier('static') |
| 3377 | // however 'static' is not a legal identifier in a strict mode. |
| 3378 | // so result of this function will be Parameter (flags = 0, name = missing, type = undefined, initializer = undefined) |
| 3379 | // and current token will not change => parsing of the enclosing parameter list will last till the end of time (or OOM) |
| 3380 | // to avoid this we'll advance cursor to the next token. |
| 3381 | p.nextToken() |
| 3382 | } |
| 3383 | return name |
| 3384 | } |
| 3385 | |
| 3386 | func (p *Parser) parseReturnType(returnToken ast.Kind, isType bool) *ast.TypeNode { |
| 3387 | if p.shouldParseReturnType(returnToken, isType) { |
no test coverage detected