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

Method parseExpectedWithDiagnostic

internal/parser/parser.go:1006–1020  ·  view source on GitHub ↗
(kind ast.Kind, message *diagnostics.Message, shouldAdvance bool)

Source from the content-addressed store, hash-verified

1004}
1005
1006func (p *Parser) parseExpectedWithDiagnostic(kind ast.Kind, message *diagnostics.Message, shouldAdvance bool) bool {
1007 if p.token == kind {
1008 if shouldAdvance {
1009 p.nextToken()
1010 }
1011 return true
1012 }
1013 // Report specific message if provided with one. Otherwise, report generic fallback message.
1014 if message != nil {
1015 p.parseErrorAtCurrentToken(message)
1016 } else {
1017 p.parseErrorAtCurrentToken(diagnostics.X_0_expected, scanner.TokenToString(kind))
1018 }
1019 return false
1020}
1021
1022func (p *Parser) parseTokenNode() *ast.Node {
1023 pos := p.nodePos()

Callers 6

parseExpectedMethod · 0.95
parseBlockMethod · 0.95
parseTryStatementMethod · 0.95

Calls 3

nextTokenMethod · 0.95
TokenToStringFunction · 0.92

Tested by

no test coverage detected