Region.stringOf
This commit is contained in:
parent
6f7578182d
commit
000949f3c3
1 changed files with 4 additions and 0 deletions
|
|
@ -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) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue