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

Function adaptSourceNode

packages/compiler-cli/preprocessor/src/tcb_adapter.ts:433–451  ·  view source on GitHub ↗
(
  node: nga.ExpressionValueMetadata,
  fileName: string,
  content?: string,
)

Source from the content-addressed store, hash-verified

431}
432
433function adaptSourceNode(
434 node: nga.ExpressionValueMetadata,
435 fileName: string,
436 content?: string,
437): SourceNode {
438 const sourceSpan = createSpan(fileName, node.sourceSpan.start, node.sourceSpan.end);
439 const source = content ? content.substring(node.sourceSpan.start, node.sourceSpan.end) : '';
440
441 if (isStaticSourceNode(node)) {
442 return {
443 kind: node.kind === 'string' ? 'string' : 'identifier',
444 text: node.text,
445 source,
446 sourceSpan,
447 } satisfies StaticSourceNode;
448 }
449
450 return {kind: 'unspecified', sourceSpan} satisfies SourceNode;
451}
452
453function declarationToMetadata(
454 decl: nga.DeclarationMetadata,

Callers 1

adaptHostElementFunction · 0.85

Calls 2

createSpanFunction · 0.85
isStaticSourceNodeFunction · 0.85

Tested by

no test coverage detected