MCPcopy Index your code
hub / github.com/microsoft/typescript-go / parseMethodDeclaration

Method parseMethodDeclaration

internal/parser/parser.go:1954–1964  ·  view source on GitHub ↗
(pos int, jsdoc jsdocScannerInfo, modifiers *ast.ModifierList, asteriskToken *ast.Node, name *ast.Node, questionToken *ast.Node, diagnosticMessage *diagnostics.Message)

Source from the content-addressed store, hash-verified

1952}
1953
1954func (p *Parser) parseMethodDeclaration(pos int, jsdoc jsdocScannerInfo, modifiers *ast.ModifierList, asteriskToken *ast.Node, name *ast.Node, questionToken *ast.Node, diagnosticMessage *diagnostics.Message) *ast.Node {
1955 signatureFlags := core.IfElse(asteriskToken != nil, ParseFlagsYield, ParseFlagsNone) | core.IfElse(modifierListHasAsync(modifiers), ParseFlagsAwait, ParseFlagsNone)
1956 typeParameters := p.parseTypeParameters()
1957 parameters := p.parseParameters(signatureFlags)
1958 typeNode := p.parseReturnType(ast.KindColonToken, false /*isType*/)
1959 body := p.parseFunctionBlockOrSemicolon(signatureFlags, diagnosticMessage)
1960 result := p.finishNode(p.factory.NewMethodDeclaration(modifiers, asteriskToken, name, questionToken, typeParameters, parameters, typeNode, nil /*fullSignature*/, body), pos)
1961 p.withJSDoc(result, jsdoc)
1962 p.checkJSSyntax(result)
1963 return result
1964}
1965
1966func modifierListHasAsync(modifiers *ast.ModifierList) bool {
1967 return modifiers != nil && core.Some(modifiers.Nodes, isAsyncModifier)

Calls 10

parseTypeParametersMethod · 0.95
parseParametersMethod · 0.95
parseReturnTypeMethod · 0.95
finishNodeMethod · 0.95
withJSDocMethod · 0.95
checkJSSyntaxMethod · 0.95
IfElseFunction · 0.92
modifierListHasAsyncFunction · 0.85
NewMethodDeclarationMethod · 0.80

Tested by

no test coverage detected