MCPcopy Create free account
hub / github.com/mozilla/source-map / eachMapping

Method eachMapping

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

Source from the content-addressed store, hash-verified

1009 }
1010
1011 eachMapping(aCallback, aContext, aOrder) {
1012 this._sections.forEach((section, index) => {
1013 const nextSection =
1014 index + 1 < this._sections.length ? this._sections[index + 1] : null;
1015 const { generatedOffset } = section;
1016
1017 const lineShift = generatedOffset.generatedLine - 1;
1018 const columnShift = generatedOffset.generatedColumn - 1;
1019
1020 section.consumer.eachMapping(
1021 function (mapping) {
1022 if (mapping.generatedLine === 1) {
1023 mapping.generatedColumn += columnShift;
1024
1025 if (typeof mapping.lastGeneratedColumn === "number") {
1026 mapping.lastGeneratedColumn += columnShift;
1027 }
1028 }
1029
1030 if (
1031 mapping.lastGeneratedColumn === Infinity &&
1032 nextSection &&
1033 mapping.generatedLine === nextSection.generatedOffset.generatedLine
1034 ) {
1035 mapping.lastGeneratedColumn =
1036 nextSection.generatedOffset.generatedColumn - 2;
1037 }
1038 mapping.generatedLine += lineShift;
1039
1040 aCallback.call(this, mapping);
1041 },
1042 aContext,
1043 aOrder
1044 );
1045 });
1046 }
1047
1048 computeColumnSpans() {
1049 for (let i = 0; i < this._sections.length; i++) {

Callers

nothing calls this directly

Calls 1

eachMappingMethod · 0.65

Tested by

no test coverage detected