(inOuterAwaitContext bool, allowAmbiguity bool)
| 3318 | } |
| 3319 | |
| 3320 | func (p *Parser) parseParameterEx(inOuterAwaitContext bool, allowAmbiguity bool) *ast.Node { |
| 3321 | pos := p.nodePos() |
| 3322 | jsdoc := p.jsdocScannerInfo() |
| 3323 | // FormalParameter [Yield,Await]: |
| 3324 | // BindingElement[?Yield,?Await] |
| 3325 | // Decorators are parsed in the outer [Await] context, the rest of the parameter is parsed in the function's [Await] context. |
| 3326 | saveContextFlags := p.contextFlags |
| 3327 | p.setContextFlags(ast.NodeFlagsAwaitContext, inOuterAwaitContext) |
| 3328 | modifiers := p.parseModifiersEx(true /*allowDecorators*/, false /*permitConstAsModifier*/, false /*stopOnStartOfClassStaticBlock*/) |
| 3329 | p.contextFlags = saveContextFlags |
| 3330 | if p.token == ast.KindThisKeyword { |
| 3331 | result := p.factory.NewParameterDeclaration( |
| 3332 | modifiers, |
| 3333 | nil, /*dotDotDotToken*/ |
| 3334 | p.createIdentifier(true /*isIdentifier*/), |
| 3335 | nil, /*questionToken*/ |
| 3336 | p.parseTypeAnnotation(), |
| 3337 | nil, /*initializer*/ |
| 3338 | ) |
| 3339 | if modifiers != nil { |
| 3340 | p.parseErrorAtRange(modifiers.Nodes[0].Loc, diagnostics.Neither_decorators_nor_modifiers_may_be_applied_to_this_parameters) |
| 3341 | } |
| 3342 | p.withJSDoc(p.finishNode(result, pos), jsdoc) |
| 3343 | return result |
| 3344 | } |
| 3345 | dotDotDotToken := p.parseOptionalToken(ast.KindDotDotDotToken) |
| 3346 | if !allowAmbiguity && !p.isParameterNameStart() { |
| 3347 | return nil |
| 3348 | } |
| 3349 | result := p.factory.NewParameterDeclaration( |
| 3350 | modifiers, |
| 3351 | dotDotDotToken, |
| 3352 | p.parseNameOfParameter(modifiers), |
| 3353 | p.parseOptionalToken(ast.KindQuestionToken), |
| 3354 | p.parseTypeAnnotation(), |
| 3355 | p.parseInitializer(), |
| 3356 | ) |
| 3357 | p.withJSDoc(p.finishNode(result, pos), jsdoc) |
| 3358 | return result |
| 3359 | } |
| 3360 | |
| 3361 | func (p *Parser) isParameterNameStart() bool { |
| 3362 | // Be permissive about await and yield by calling isBindingIdentifier instead of isIdentifier; disallowing |
no test coverage detected