MCPcopy Create free account
hub / github.com/compiler-explorer/compiler-explorer / replaceAllText

Method replaceAllText

lib/demangler/prefix-tree.ts:147–161  ·  view source on GitHub ↗
(line: string)

Source from the content-addressed store, hash-verified

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}

Callers 2

demangleMethod · 0.80
demangler-tests.tsFile · 0.80

Calls 1

findLongestMatchMethod · 0.95

Tested by

no test coverage detected