@internal
(index: number)
| 936 | |
| 937 | /** @internal */ |
| 938 | _split(index: number): boolean | void { |
| 939 | if (this.byStart.get(index) || this.byEnd.get(index)) |
| 940 | return |
| 941 | |
| 942 | if (DEBUG) |
| 943 | this.stats.time('_split') |
| 944 | |
| 945 | let chunk = this.lastSearchedChunk |
| 946 | let previousChunk = chunk |
| 947 | const searchForward = index > chunk.end |
| 948 | |
| 949 | while (chunk) { |
| 950 | if (chunk.contains(index)) |
| 951 | return this._splitChunk(chunk, index) |
| 952 | |
| 953 | chunk = searchForward ? this.byStart.get(chunk.end) : this.byEnd.get(chunk.start) |
| 954 | |
| 955 | // Prevent infinite loop (e.g. via empty chunks, where start === end) |
| 956 | if (chunk === previousChunk) |
| 957 | return |
| 958 | |
| 959 | previousChunk = chunk |
| 960 | } |
| 961 | } |
| 962 | |
| 963 | /** @internal */ |
| 964 | _splitChunk(chunk: Chunk, index: number): true { |
no test coverage detected