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

Function convertSourceSpan

packages/compiler/src/template/pipeline/src/ingest.ts:1946–1957  ·  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

1944 * @returns a `ParseSourceSpan` for the given span or null if no `baseSourceSpan` was provided.
1945 */
1946function convertSourceSpan(
1947 span: e.ParseSpan,
1948 baseSourceSpan: ParseSourceSpan | null,
1949): ParseSourceSpan | null {
1950 if (baseSourceSpan === null) {
1951 return null;
1952 }
1953 const start = baseSourceSpan.start.moveBy(span.start);
1954 const end = baseSourceSpan.start.moveBy(span.end);
1955 const fullStart = baseSourceSpan.fullStart.moveBy(span.start);
1956 return new ParseSourceSpan(start, end, fullStart);
1957}
1958
1959/**
1960 * 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