MCPcopy Create free account
hub / github.com/angular/angular / getDiagnosticNode

Function getDiagnosticNode

packages/compiler-cli/src/ngtsc/scope/src/util.ts:17–27  ·  view source on GitHub ↗
(
  ref: Reference<ClassDeclaration>,
  rawExpr: ts.Expression | null,
)

Source from the content-addressed store, hash-verified

15import {ComponentScopeKind, ComponentScopeReader} from './api';
16
17export function getDiagnosticNode(
18 ref: Reference<ClassDeclaration>,
19 rawExpr: ts.Expression | null,
20): ts.Expression {
21 // Show the diagnostic on the node within `rawExpr` which references the declaration
22 // in question. `rawExpr` represents the raw expression from which `ref` was partially evaluated,
23 // so use that to find the right node. Note that by the type system, `rawExpr` might be `null`, so
24 // fall back on the declaration identifier in that case (even though in practice this should never
25 // happen since local NgModules always have associated expressions).
26 return rawExpr !== null ? ref.getOriginForDiagnostics(rawExpr) : ref.node.name;
27}
28
29export function makeNotStandaloneDiagnostic(
30 scopeReader: ComponentScopeReader,

Calls 1

Tested by

no test coverage detected