@internal
(index: number)
| 1117 | |
| 1118 | /** @internal */ |
| 1119 | _split(index: number): boolean | void { |
| 1120 | if (this.byStart.get(index) || this.byEnd.get(index)) |
| 1121 | return |
| 1122 | |
| 1123 | /* v8 ignore next 2 -- DEBUG is always true in tests */ |
| 1124 | if (DEBUG) |
| 1125 | this.stats.time('_split') |
| 1126 | |
| 1127 | let chunk = this.lastSearchedChunk |
| 1128 | let previousChunk = chunk |
| 1129 | const searchForward = index > chunk.end |
| 1130 | |
| 1131 | while (chunk) { |
| 1132 | if (chunk.contains(index)) |
| 1133 | return this._splitChunk(chunk, index) |
| 1134 | |
| 1135 | chunk = searchForward ? this.byStart.get(chunk.end) : this.byEnd.get(chunk.start) |
| 1136 | |
| 1137 | // Prevent infinite loop (e.g. via empty chunks, where start === end) |
| 1138 | if (chunk === previousChunk) |
| 1139 | return |
| 1140 | |
| 1141 | previousChunk = chunk |
| 1142 | } |
| 1143 | } |
| 1144 | |
| 1145 | /** @internal */ |
| 1146 | _splitChunk(chunk: Chunk, index: number): true { |
no test coverage detected