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