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

Function convertSourceSpan

packages/compiler/src/template/pipeline/src/ingest.ts:1830–1841  ·  view source on GitHub ↗

* Creates an absolute `ParseSourceSpan` from the relative `ParseSpan`. * * `ParseSpan` objects are relative to the start of the expression. * This method converts these to full `ParseSourceSpan` objects that * show where the span is within the overall source file. * * @param span the relative

(
  span: e.ParseSpan,
  baseSourceSpan: ParseSourceSpan | null,
)

Source from the content-addressed store, hash-verified

1828 * @returns a `ParseSourceSpan` for the given span or null if no `baseSourceSpan` was provided.
1829 */
1830function convertSourceSpan(
1831 span: e.ParseSpan,
1832 baseSourceSpan: ParseSourceSpan | null,
1833): ParseSourceSpan | null {
1834 if (baseSourceSpan === null) {
1835 return null;
1836 }
1837 const start = baseSourceSpan.start.moveBy(span.start);
1838 const end = baseSourceSpan.start.moveBy(span.end);
1839 const fullStart = baseSourceSpan.fullStart.moveBy(span.start);
1840 return new ParseSourceSpan(start, end, fullStart);
1841}
1842
1843/**
1844 * With the directive-based control flow users were able to conditionally project content using

Callers 3

ingestForBlockFunction · 0.85
convertAstFunction · 0.85
convertTemplateLiteralFunction · 0.85

Calls 1

moveByMethod · 0.80

Tested by

no test coverage detected