()
| 19 | } |
| 20 | |
| 21 | get lineOffsets(): number[] { |
| 22 | if (this._lineOffsets == null) { |
| 23 | const offsets: number[] = []; |
| 24 | const text = this.source; |
| 25 | let isLineStart = true; |
| 26 | let i = 0; |
| 27 | while (i < text.length) { |
| 28 | if (isLineStart) { |
| 29 | offsets.push(i); |
| 30 | isLineStart = false; |
| 31 | } |
| 32 | const ch = text.charCodeAt(i); |
| 33 | isLineStart = ch === 13 || ch === 10 || ch === 0x2028 || ch === 0x2029; |
| 34 | if (ch === 13 && i + 1 < text.length && text.charCodeAt(i + 1) === 10) { |
| 35 | i++; |
| 36 | } |
| 37 | i++; |
| 38 | } |
| 39 | if (isLineStart && text.length > 0) offsets.push(text.length); |
| 40 | this._lineOffsets = offsets; |
| 41 | } |
| 42 | return this._lineOffsets; |
| 43 | } |
| 44 | |
| 45 | getLinecol(offset: number): [line: number, col: number] { |
| 46 | offset = Math.max(Math.min(offset, this.source.length), 0); |
nothing calls this directly
no outgoing calls
no test coverage detected