MCPcopy Index your code
hub / github.com/angular/angular / defaultGatherDiagnostics

Function defaultGatherDiagnostics

packages/compiler-cli/src/perform_compile.ts:328–362  ·  view source on GitHub ↗
(program: api.Program)

Source from the content-addressed store, hash-verified

326 }
327}
328export function defaultGatherDiagnostics(program: api.Program): ReadonlyArray<ts.Diagnostic> {
329 const allDiagnostics: Array<ts.Diagnostic> = [];
330
331 function checkDiagnostics(diags: ReadonlyArray<ts.Diagnostic> | undefined) {
332 if (diags) {
333 allDiagnostics.push(...diags);
334 return !hasErrors(diags);
335 }
336 return true;
337 }
338
339 let checkOtherDiagnostics = true;
340 // Check parameter diagnostics
341 checkOtherDiagnostics =
342 checkOtherDiagnostics &&
343 checkDiagnostics([...program.getTsOptionDiagnostics(), ...program.getNgOptionDiagnostics()]);
344
345 // Check syntactic diagnostics
346 checkOtherDiagnostics =
347 checkOtherDiagnostics && checkDiagnostics(program.getTsSyntacticDiagnostics());
348
349 // Check TypeScript semantic and Angular structure diagnostics
350 checkOtherDiagnostics =
351 checkOtherDiagnostics &&
352 checkDiagnostics([
353 ...program.getTsSemanticDiagnostics(),
354 ...program.getNgStructuralDiagnostics(),
355 ]);
356
357 // Check Angular semantic diagnostics
358 checkOtherDiagnostics =
359 checkOtherDiagnostics && checkDiagnostics(program.getNgSemanticDiagnostics());
360
361 return allDiagnostics;
362}
363
364function hasErrors(diags: ReadonlyArray<ts.Diagnostic>) {
365 return diags.some((d) => d.category === ts.DiagnosticCategory.Error);

Callers 1

driveDiagnosticsAsyncMethod · 0.85

Calls 7

checkDiagnosticsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…