* 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, )
| 1828 | * @returns a `ParseSourceSpan` for the given span or null if no `baseSourceSpan` was provided. |
| 1829 | */ |
| 1830 | function 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 |
no test coverage detected