(chunk, index)
| 680 | } |
| 681 | |
| 682 | _splitChunk(chunk, index) { |
| 683 | if (chunk.edited && chunk.content.length) { |
| 684 | // zero-length edited chunks are a special case (overlapping replacements) |
| 685 | const loc = getLocator(this.original)(index); |
| 686 | throw new Error( |
| 687 | `Cannot split a chunk that has already been edited (${loc.line}:${loc.column} – "${chunk.original}")`, |
| 688 | ); |
| 689 | } |
| 690 | |
| 691 | const newChunk = chunk.split(index); |
| 692 | |
| 693 | this.byEnd[index] = chunk; |
| 694 | this.byStart[index] = newChunk; |
| 695 | this.byEnd[newChunk.end] = newChunk; |
| 696 | |
| 697 | if (chunk === this.lastChunk) this.lastChunk = newChunk; |
| 698 | |
| 699 | this.lastSearchedChunk = chunk; |
| 700 | if (DEBUG) this.stats.timeEnd('_split'); |
| 701 | return true; |
| 702 | } |
| 703 | |
| 704 | toString() { |
| 705 | let str = this.intro; |
no test coverage detected