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

Method collectCheckerDiagnostics

internal/compiler/program.go:567–578  ·  view source on GitHub ↗

collectCheckerDiagnostics collects diagnostics from a single file or all files, using a callback that receives the checker for each file. When the checker pool supports grouped iteration (compiler pool), files are grouped by checker and processed in parallel with one task per checker, reducing conte

(ctx context.Context, sourceFile *ast.SourceFile, collect func(context.Context, *checker.Checker, *ast.SourceFile) []*ast.Diagnostic)

Source from the content-addressed store, hash-verified

565// processed in parallel with one task per checker, reducing contention and improving
566// cache locality. Otherwise, falls back to per-file concurrent collection.
567func (p *Program) collectCheckerDiagnostics(ctx context.Context, sourceFile *ast.SourceFile, collect func(context.Context, *checker.Checker, *ast.SourceFile) []*ast.Diagnostic) []*ast.Diagnostic {
568 if sourceFile != nil {
569 if p.SkipTypeChecking(sourceFile, false) {
570 return nil
571 }
572 c, done := p.GetTypeCheckerForFileExclusive(ctx, sourceFile)
573 result := collect(ctx, c, sourceFile)
574 done()
575 return SortAndDeduplicateDiagnostics(result)
576 }
577 return SortAndDeduplicateDiagnostics(slices.Concat(p.collectCheckerDiagnosticsFromFiles(ctx, p.files, collect)...))
578}
579
580// collectCheckerDiagnosticsFromFiles collects checker diagnostics for a list of files.
581func (p *Program) collectCheckerDiagnosticsFromFiles(ctx context.Context, sourceFiles []*ast.SourceFile, collect func(context.Context, *checker.Checker, *ast.SourceFile) []*ast.Diagnostic) [][]*ast.Diagnostic {

Callers 2

Tested by

no test coverage detected