@internal
(index: number)
| 1174 | |
| 1175 | /** @internal */ |
| 1176 | _split(index: number): boolean | void { |
| 1177 | if (this.byStart.get(index) || this.byEnd.get(index)) |
| 1178 | return |
| 1179 | |
| 1180 | /* v8 ignore next 2 -- DEBUG is always true in tests */ |
| 1181 | if (DEBUG) |
| 1182 | this.stats.time('_split') |
| 1183 | |
| 1184 | let chunk = this.lastSearchedChunk |
| 1185 | let previousChunk = chunk |
| 1186 | const searchForward = index > chunk.end |
| 1187 | |
| 1188 | while (chunk) { |
| 1189 | if (chunk.contains(index)) |
| 1190 | return this._splitChunk(chunk, index) |
| 1191 | |
| 1192 | chunk = searchForward ? this.byStart.get(chunk.end) : this.byEnd.get(chunk.start) |
| 1193 | |
| 1194 | // Prevent infinite loop (e.g. via empty chunks, where start === end) |
| 1195 | if (chunk === previousChunk) |
| 1196 | return |
| 1197 | |
| 1198 | previousChunk = chunk |
| 1199 | } |
| 1200 | } |
| 1201 | |
| 1202 | /** @internal */ |
| 1203 | _splitChunk(chunk: Chunk, index: number): true { |
no test coverage detected