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

Method parseErrorAtRange

internal/parser/parser.go:329–338  ·  view source on GitHub ↗
(loc core.TextRange, message *diagnostics.Message, args ...any)

Source from the content-addressed store, hash-verified

327}
328
329func (p *Parser) parseErrorAtRange(loc core.TextRange, message *diagnostics.Message, args ...any) *ast.Diagnostic {
330 // Don't report another error if it would just be at the same location as the last error
331 var result *ast.Diagnostic
332 if len(p.diagnostics) == 0 || p.diagnostics[len(p.diagnostics)-1].Pos() != loc.Pos() {
333 result = ast.NewDiagnostic(nil, loc, message, args...)
334 p.diagnostics = append(p.diagnostics, result)
335 }
336 p.hasParseError = true
337 return result
338}
339
340type ParserState struct {
341 scannerState scanner.ScannerState

Calls 4

NewDiagnosticFunction · 0.92
lenFunction · 0.85
PosMethod · 0.65
appendFunction · 0.50

Tested by

no test coverage detected