@internal
(index: number)
| 1081 | |
| 1082 | /** @internal */ |
| 1083 | _split(index: number): boolean | void { |
| 1084 | if (this.byStart.get(index) || this.byEnd.get(index)) |
| 1085 | return |
| 1086 | |
| 1087 | if (DEBUG) |
| 1088 | this.stats.time('_split') |
| 1089 | |
| 1090 | let chunk = this.lastSearchedChunk |
| 1091 | let previousChunk = chunk |
| 1092 | const searchForward = index > chunk.end |
| 1093 | |
| 1094 | while (chunk) { |
| 1095 | if (chunk.contains(index)) |
| 1096 | return this._splitChunk(chunk, index) |
| 1097 | |
| 1098 | chunk = searchForward ? this.byStart.get(chunk.end) : this.byEnd.get(chunk.start) |
| 1099 | |
| 1100 | // Prevent infinite loop (e.g. via empty chunks, where start === end) |
| 1101 | if (chunk === previousChunk) |
| 1102 | return |
| 1103 | |
| 1104 | previousChunk = chunk |
| 1105 | } |
| 1106 | } |
| 1107 | |
| 1108 | /** @internal */ |
| 1109 | _splitChunk(chunk: Chunk, index: number): true { |
no test coverage detected