@internal
(index: number)
| 1148 | |
| 1149 | /** @internal */ |
| 1150 | _split(index: number): boolean | void { |
| 1151 | if (this.byStart.get(index) || this.byEnd.get(index)) |
| 1152 | return |
| 1153 | |
| 1154 | let chunk: Chunk | undefined = this.lastSearchedChunk |
| 1155 | let previousChunk: Chunk | undefined = chunk |
| 1156 | const searchForward = index > chunk.end |
| 1157 | |
| 1158 | while (chunk) { |
| 1159 | if (chunk.contains(index)) |
| 1160 | return this._splitChunk(chunk, index) |
| 1161 | |
| 1162 | chunk = searchForward ? this.byStart.get(chunk.end) : this.byEnd.get(chunk.start) |
| 1163 | |
| 1164 | // Prevent infinite loop (e.g. via empty chunks, where start === end) |
| 1165 | if (chunk === previousChunk) |
| 1166 | return |
| 1167 | |
| 1168 | previousChunk = chunk |
| 1169 | } |
| 1170 | } |
| 1171 | |
| 1172 | /** @internal */ |
| 1173 | _splitChunk(chunk: Chunk, index: number): true { |
no test coverage detected