MCPcopy Index your code
hub / github.com/mozilla/source-map / eachMapping

Method eachMapping

lib/source-map-consumer.js:354–386  ·  view source on GitHub ↗
(aCallback, aContext, aOrder)

Source from the content-addressed store, hash-verified

352 }
353
354 eachMapping(aCallback, aContext, aOrder) {
355 const context = aContext || null;
356 const order = aOrder || SourceMapConsumer.GENERATED_ORDER;
357
358 this._wasm.withMappingCallback(
359 mapping => {
360 if (mapping.source !== null) {
361 mapping.source = this._absoluteSources.at(mapping.source);
362
363 if (mapping.name !== null) {
364 mapping.name = this._names.at(mapping.name);
365 }
366 }
367 if (this._computedColumnSpans && mapping.lastGeneratedColumn === null) {
368 mapping.lastGeneratedColumn = Infinity;
369 }
370
371 aCallback.call(context, mapping);
372 },
373 () => {
374 switch (order) {
375 case SourceMapConsumer.GENERATED_ORDER:
376 this._wasm.exports.by_generated_location(this._getMappingsPtr());
377 break;
378 case SourceMapConsumer.ORIGINAL_ORDER:
379 this._wasm.exports.by_original_location(this._getMappingsPtr());
380 break;
381 default:
382 throw new Error("Unknown order of iteration.");
383 }
384 }
385 );
386 }
387
388 allGeneratedPositionsFor(aArgs) {
389 let source = util.getArg(aArgs, "source");

Callers

nothing calls this directly

Calls 2

_getMappingsPtrMethod · 0.95
atMethod · 0.80

Tested by

no test coverage detected