MCPcopy Create free account
hub / github.com/Rich-Harris/magic-string / addUneditedChunk

Method addUneditedChunk

benchmark/data.js:235–257  ·  view source on GitHub ↗
(sourceIndex, chunk, original, loc, sourcemapLocations)

Source from the content-addressed store, hash-verified

233 this.pending = null;
234 }
235 addUneditedChunk(sourceIndex, chunk, original, loc, sourcemapLocations) {
236 let originalCharIndex = chunk.start;
237 let first = true;
238 while (originalCharIndex < chunk.end) {
239 if (this.hires || first || sourcemapLocations.has(originalCharIndex)) {
240 this.rawSegments.push([this.generatedCodeColumn, sourceIndex, loc.line, loc.column]);
241 }
242 if (original[originalCharIndex] === '\n') {
243 loc.line += 1;
244 loc.column = 0;
245 this.generatedCodeLine += 1;
246 this.raw[this.generatedCodeLine] = this.rawSegments = [];
247 this.generatedCodeColumn = 0;
248 first = true;
249 } else {
250 loc.column += 1;
251 this.generatedCodeColumn += 1;
252 first = false;
253 }
254 originalCharIndex += 1;
255 }
256 this.pending = null;
257 }
258 advance(str) {
259 if (!str) return;
260 const lines = str.split('\n');

Callers 2

generateDecodedMapMethod · 0.95
generateDecodedMapMethod · 0.95

Calls 1

hasMethod · 0.45

Tested by

no test coverage detected