Region.stringOf

This commit is contained in:
Yura Dupyn 2026-04-22 18:53:28 +02:00
parent 6f7578182d
commit 000949f3c3

View file

@ -241,6 +241,10 @@ export class SourceRegion {
return this.source.sliceByCp(this.span.start.index, this.span.end.index); return this.source.sliceByCp(this.span.start.index, this.span.end.index);
} }
stringOf(span: Span): string {
return this.subRegion(span).toString();
}
// Returns a Span for the given line (1-based index). // Returns a Span for the given line (1-based index).
getLineSpan(line: number, stripNewlines = true): Span { getLineSpan(line: number, stripNewlines = true): Span {
if (line < this.span.start.line || line > this.span.end.line) { if (line < this.span.start.line || line > this.span.end.line) {