()
| 3780 | } |
| 3781 | |
| 3782 | func (p *Parser) parseFunctionOrConstructorType() *ast.TypeNode { |
| 3783 | pos := p.nodePos() |
| 3784 | jsdoc := p.jsdocScannerInfo() |
| 3785 | modifiers := p.parseModifiersForConstructorType() |
| 3786 | isConstructorType := p.parseOptional(ast.KindNewKeyword) |
| 3787 | debug.Assert(modifiers == nil || isConstructorType, "Per isStartOfFunctionOrConstructorType, a function type cannot have modifiers.") |
| 3788 | typeParameters := p.parseTypeParameters() |
| 3789 | parameters := p.parseParameters(ParseFlagsType) |
| 3790 | returnType := p.parseReturnType(ast.KindEqualsGreaterThanToken, false /*isType*/) |
| 3791 | var result *ast.TypeNode |
| 3792 | if isConstructorType { |
| 3793 | result = p.factory.NewConstructorTypeNode(modifiers, typeParameters, parameters, returnType) |
| 3794 | } else { |
| 3795 | result = p.factory.NewFunctionTypeNode(typeParameters, parameters, returnType) |
| 3796 | } |
| 3797 | p.finishNode(result, pos) |
| 3798 | p.withJSDoc(result, jsdoc) |
| 3799 | return result |
| 3800 | } |
| 3801 | |
| 3802 | func (p *Parser) parseModifiersForConstructorType() *ast.ModifierList { |
| 3803 | if p.token == ast.KindAbstractKeyword { |
no test coverage detected