@internal
(index: number)
| 967 | |
| 968 | /** @internal */ |
| 969 | _split(index: number): boolean | void { |
| 970 | if (this.byStart.get(index) || this.byEnd.get(index)) |
| 971 | return |
| 972 | |
| 973 | if (DEBUG) |
| 974 | this.stats.time('_split') |
| 975 | |
| 976 | let chunk = this.lastSearchedChunk |
| 977 | let previousChunk = chunk |
| 978 | const searchForward = index > chunk.end |
| 979 | |
| 980 | while (chunk) { |
| 981 | if (chunk.contains(index)) |
| 982 | return this._splitChunk(chunk, index) |
| 983 | |
| 984 | chunk = searchForward ? this.byStart.get(chunk.end) : this.byEnd.get(chunk.start) |
| 985 | |
| 986 | // Prevent infinite loop (e.g. via empty chunks, where start === end) |
| 987 | if (chunk === previousChunk) |
| 988 | return |
| 989 | |
| 990 | previousChunk = chunk |
| 991 | } |
| 992 | } |
| 993 | |
| 994 | /** @internal */ |
| 995 | _splitChunk(chunk: Chunk, index: number): true { |
no test coverage detected