(line: string)
| 145 | // mapping (e.g. opt-pipeline pass-dump demangling) would otherwise allocate |
| 146 | // per line and immediately discard. |
| 147 | replaceAllText(line: string): string { |
| 148 | let newText = ''; |
| 149 | let idxInOld = 0; |
| 150 | while (idxInOld < line.length) { |
| 151 | const [oldValue, newValue] = this.findLongestMatch(line, idxInOld); |
| 152 | if (oldValue) { |
| 153 | newText += newValue; |
| 154 | idxInOld += oldValue.length; |
| 155 | } else { |
| 156 | newText += line[idxInOld]; |
| 157 | idxInOld++; |
| 158 | } |
| 159 | } |
| 160 | return newText; |
| 161 | } |
| 162 | } |
no test coverage detected