|
684 | 684 | 1. Let _ignoreListField_ be GetOptionalListOfArrayIndexes(_json_, *"ignoreList"*). |
685 | 685 | 1. Let _sources_ be DecodeSourceMapSources(_baseURL_, _sourceRootField_, _sourcesField_, _sourcesContentField_, _ignoreListField_). |
686 | 686 | 1. Let _namesField_ be GetOptionalListOfStrings(_json_, *"names"*). |
| 687 | + 1. Let _mappings_ be DecodeMappings(_mappingsField_, _namesField_, _sources_). |
687 | 688 | 1. <ins>Let _rangeMappingsField_ be GetOptionalString(_json_, *"rangeMappings"*).</ins> |
688 | 689 | 1. <ins>Let _rangeMappings_ be DecodeRangeMappings(_rangeMappingsField_).</ins> |
689 | | - 1. Let _mappings_ be DecodeMappings(_mappingsField_, _namesField_, _sources_, <ins>_rangeMappings_</ins>). |
| 690 | + 1. <ins>Perform UpdateMappingsForRangeMappings(_mappings_, _rangeMappings_).</ins> |
690 | 691 | 1. [declared="a,b"] Sort _mappings_ in ascending order, with a Decoded Mapping Record _a_ being less than a Decoded Mapping Record _b_ if ComparePositions(_a_.[[GeneratedPosition]], _b_.[[GeneratedPosition]]) is ~lesser~. |
691 | 692 | 1. Return the Decoded Source Map Record { [[File]]: _fileField_, [[Sources]]: _sources_, [[Mappings]]: _mappings_ }. |
692 | 693 | </emu-alg> |
|
921 | 922 | <td>[[NameIndex]]</td> |
922 | 923 | <td>a non-negative integer</td> |
923 | 924 | </tr> |
924 | | - <tr> |
925 | | - <td><ins>[[MappingIndex]]</ins></td> |
926 | | - <td><ins>a non-negative integer</ins></td> |
927 | | - </tr> |
928 | 925 | </table> |
929 | 926 | </emu-table> |
930 | 927 |
|
|
935 | 932 | _mappings_: a List of Decoded Mapping Records, |
936 | 933 | _names_: a List of Strings, |
937 | 934 | _sources_: a List of Decoded Source Records, |
938 | | - <ins>_rangeMappings_: a List of of Decoded Range Mapping Offset Records,</ins> |
939 | 935 | ) |
940 | 936 | </h1> |
941 | 937 | <dl class="header"></dl> |
|
944 | 940 | Line `;` LineList |
945 | 941 | </emu-grammar> |
946 | 942 | <emu-alg> |
947 | | - 1. Perform DecodeMappingsField of |Line| with arguments _state_, _mappings_, _names_<ins>,</ins> <del>and</del> _sources_ <ins>and _rangeMappings_</ins>. |
| 943 | + 1. Perform DecodeMappingsField of |Line| with arguments _state_, _mappings_, _names_ and _sources_. |
948 | 944 | 1. Set _state_.[[GeneratedLine]] to _state_.[[GeneratedLine]] + 1. |
949 | 945 | 1. Set _state_.[[GeneratedColumn]] to 0. |
950 | | - 1. <ins>Set _state_.[[MappingIndex]] to 0.</ins> |
951 | | - 1. Perform DecodeMappingsField of |LineList| with arguments _state_, _mappings_, _names_<ins>,</ins> <del>and</del> _sources_ <ins>and _rangeMappings_</ins>. |
| 946 | + 1. Perform DecodeMappingsField of |LineList| with arguments _state_, _mappings_, _names_ and _sources_. |
952 | 947 | </emu-alg> |
953 | 948 | <emu-grammar> |
954 | 949 | Line : [empty] |
|
961 | 956 | Mapping `,` MappingList |
962 | 957 | </emu-grammar> |
963 | 958 | <emu-alg> |
964 | | - 1. Perform DecodeMappingsField of |Mapping| with arguments _state_, _mappings_, _names_<ins>,</ins> <del>and</del> _sources_ <ins>and _rangeMappings_</ins>. |
965 | | - 1. Perform DecodeMappingsField of |MappingList| with arguments _state_, _mappings_, _names_<ins>,</ins> <del>and</del> _sources_ <ins>and _rangeMappings_</ins>. |
| 959 | + 1. Perform DecodeMappingsField of |Mapping| with arguments _state_, _mappings_, _names_ and _sources_. |
| 960 | + 1. Perform DecodeMappingsField of |MappingList| with arguments _state_, _mappings_, _names_ and _sources_. |
966 | 961 | </emu-alg> |
967 | 962 | <emu-grammar> |
968 | 963 | Mapping : |
969 | 964 | GeneratedColumn |
970 | 965 | </emu-grammar> |
971 | 966 | <emu-alg> |
972 | | - 1. Perform DecodeMappingsField of |GeneratedColumn| with arguments _state_, _mappings_, _names_<ins>,</ins> <del>and</del> _sources_ <ins>and _rangeMappings_</ins>. |
| 967 | + 1. Perform DecodeMappingsField of |GeneratedColumn| with arguments _state_, _mappings_, _names_ and _sources_. |
973 | 968 | 1. If _state_.[[GeneratedColumn]] < 0, then |
974 | 969 | 1. Optionally report an error. |
975 | 970 | 1. Return. |
976 | 971 | 1. Let _position_ be a new Position Record { [[Line]]: _state_.[[GeneratedLine]], [[Column]]: _state_.[[GeneratedColumn]] }. |
977 | 972 | 1. Let _decodedMapping_ be a new DecodedMappingRecord { [[GeneratedPosition]]: _position_, [[OriginalPosition]]: *null*, [[Name]]: *null*, <ins>[[IsRangeMapping]]: *false*</ins> }. |
978 | 973 | 1. Append _decodedMapping_ to _mappings_. |
979 | | - 1. <ins>Set _state_.[[MappingIndex]] to _state_.[[MappingIndex]] + 1.</ins> |
980 | 974 | </emu-alg> |
981 | 975 | <emu-grammar> |
982 | 976 | Mapping : |
983 | 977 | GeneratedColumn OriginalSource OriginalLine OriginalColumn Name? |
984 | 978 | </emu-grammar> |
985 | 979 | <emu-alg> |
986 | | - 1. Perform DecodeMappingsField of |GeneratedColumn| with arguments _state_, _mappings_, _names_<ins>,</ins> <del>and</del> _sources_ <ins>and _rangeMappings_</ins>. |
| 980 | + 1. Perform DecodeMappingsField of |GeneratedColumn| with arguments _state_, _mappings_, _names_ and _sources_. |
987 | 981 | 1. If _state_.[[GeneratedColumn]] < 0, then |
988 | 982 | 1. Optionally report an error. |
989 | 983 | 1. Return. |
990 | 984 | 1. Let _generatedPosition_ be a new Position Record { [[Line]]: _state_.[[GeneratedLine]], [[Column]]: _state_.[[GeneratedColumn]] }. |
991 | | - 1. Perform DecodeMappingsField of |OriginalSource| with arguments _state_, _mappings_, _names_<ins>,</ins> <del>and</del> _sources_ <ins>and _rangeMappings_</ins>. |
992 | | - 1. Perform DecodeMappingsField of |OriginalLine| with arguments _state_, _mappings_, _names_<ins>,</ins> <del>and</del> _sources_ <ins>and _rangeMappings_</ins>. |
993 | | - 1. Perform DecodeMappingsField of |OriginalColumn| with arguments _state_, _mappings_, _names_<ins>,</ins> <del>and</del> _sources_ <ins>and _rangeMappings_</ins>. |
| 985 | + 1. Perform DecodeMappingsField of |OriginalSource| with arguments _state_, _mappings_, _names_ and _sources_. |
| 986 | + 1. Perform DecodeMappingsField of |OriginalLine| with arguments _state_, _mappings_, _names_ and _sources_. |
| 987 | + 1. Perform DecodeMappingsField of |OriginalColumn| with arguments _state_, _mappings_, _names_ and _sources_. |
994 | 988 | 1. If _state_.[[SourceIndex]] < 0 or _state_.[[SourceIndex]] ≥ the number of elements of _sources_ or _state_.[[OriginalLine]] < 0 or _state_.[[OriginalColumn]] < 0, then |
995 | 989 | 1. Optionally report an error. |
996 | 990 | 1. Let _originalPosition_ be *null*. |
997 | 991 | 1. Else, |
998 | 992 | 1. Let _originalPosition_ be a new Original Position Record { [[Source]]: _sources_[_state_.[[SourceIndex]]], [[Line]]: _state_.[[OriginalLine]], [[Column]]: _state_.[[OriginalColumn]] }. |
999 | 993 | 1. Let _name_ be *null*. |
1000 | 994 | 1. If |Name| is present, then |
1001 | | - 1. Perform DecodeMappingsField of |Name| with arguments _state_, _mappings_, _names_<ins>,</ins> <del>and</del> _sources_ <ins>and _rangeMappings_</ins>. |
| 995 | + 1. Perform DecodeMappingsField of |Name| with arguments _state_, _mappings_, _names_ and _sources_. |
1002 | 996 | 1. If _state_.[[NameIndex]] < 0 or _state_.[[NameIndex]] ≥ the number of elements of _names_, optionally report an error. |
1003 | 997 | 1. Else, set _name_ to _names_[_state_.[[NameIndex]]]. |
1004 | | - 1. <ins>Let _isRangeMapping_ be the result of performing LookupRangeMapping with arguments _rangeMappings_, _state_.[[GeneratedLine]], and _state_.[[MappingIndex]].</ins> |
1005 | | - 1. Let _decodedMapping_ be a new DecodedMappingRecord { [[GeneratedPosition]]: _generatedPosition_, [[OriginalPosition]]: _originalPosition_, [[Name]]: _name_, <ins>[[IsRangeMapping]]: _isRangeMapping_</ins> }. |
| 998 | + 1. Let _decodedMapping_ be a new DecodedMappingRecord { [[GeneratedPosition]]: _generatedPosition_, [[OriginalPosition]]: _originalPosition_, [[Name]]: _name_, <ins>[[IsRangeMapping]]: *false*</ins> }. |
1006 | 999 | 1. Append _decodedMapping_ to _mappings_. |
1007 | | - 1. <ins>Set _state_.[[MappingIndex]] to _state_.[[MappingIndex]] + 1.</ins> |
1008 | 1000 | </emu-alg> |
1009 | 1001 | <emu-grammar> |
1010 | 1002 | GeneratedColumn : |
|
1055 | 1047 | _rawMappings_: a String, |
1056 | 1048 | _names_: a List of Strings, |
1057 | 1049 | _sources_: a List of Decoded Source Records, |
1058 | | - <ins>_rangeMappings_: a List of Decoded Range Mapping Offset Records,</ins> |
1059 | 1050 | ): a List of Decoded Mapping Record |
1060 | 1051 | </h1> |
1061 | 1052 | <dl class="header"></dl> |
|
1066 | 1057 | 1. Optionally report an error. |
1067 | 1058 | 1. Return _mappings_. |
1068 | 1059 | 1. Let _state_ be a new Decode Mapping State Record with all fields set to 0. |
1069 | | - 1. Perform DecodeMappingsField of _mappingsNode_ with arguments _state_, _mappings_, _names_<ins>,</ins> <del>and</del> _sources_ <ins>and _rangeMappings_</ins>. |
| 1060 | + 1. Perform DecodeMappingsField of _mappingsNode_ with arguments _state_, _mappings_, _names_ and _sources_. |
1070 | 1061 | 1. Return _mappings_. |
1071 | 1062 | </emu-alg> |
1072 | 1063 | </emu-clause> |
|
1255 | 1246 | </emu-alg> |
1256 | 1247 | </emu-clause> |
1257 | 1248 |
|
1258 | | - <emu-clause id="sec-LookupRangeMapping" type="abstract operation"> |
| 1249 | + <emu-clause id="sec-UpdateMappingsForRangeMapping" type="abstract operation"> |
1259 | 1250 | <h1> |
1260 | | - LookupRangeMapping ( |
1261 | | - _rangeMappings_: a List of Decoded Range Mapping Offset Records, |
1262 | | - _generatedLine_: an integral Number, |
1263 | | - _mappingIndex_: an integral Number, |
1264 | | - ): a Boolean |
| 1251 | + UpdateMappingsForRangeMappings ( |
| 1252 | + _mappings_: a List of Decoded Mapping Records, |
| 1253 | + _rangeMappingsOffsets_: a List of Decoded Range Mapping Offset Records, |
| 1254 | + ): ~unused~ |
1265 | 1255 | </h1> |
1266 | 1256 | <dl class="header"></dl> |
1267 | 1257 | <emu-alg> |
1268 | | - 1. Let _rangeMappingOffset_ be a new Decoded Range Mapping Offset Record { [[GeneratedLine]] : _generatedLine_, [[MappingIndex]]: _mappingIndex_ }. |
1269 | | - 1. If _rangeMappingOffset_ is an element of _rangeMappings_, then |
1270 | | - 1. Return *true*. |
1271 | | - 1. Else, |
1272 | | - 1. Return *false*. |
| 1258 | + 1. For each Decoded Range Mapping Offset Record _rangeMappingOffset_ of _rangeMappingsOffsets_, do |
| 1259 | + 1. Let _mapping_ be the result of FindMappingForRangeMappingOffset(_mappings_, _rangeMappingOffset_). |
| 1260 | + 1. If _mapping_ is ~not-found~, optionally report an error. |
| 1261 | + 1. If _mapping_.[[OriginalPosition]] is *null*, optionally report an error. |
| 1262 | + 1. Assert: _mapping_.[[IsRangeMapping]] is *false*. |
| 1263 | + 1. Set _mapping_.[[IsRangeMapping]] to *true*. |
| 1264 | + </emu-alg> |
| 1265 | + </emu-clause> |
| 1266 | + |
| 1267 | + <emu-clause id="sec-FindMappingForRangeMappingOffset" type="abstract operation"> |
| 1268 | + <h1> |
| 1269 | + FindMappingForRangeMappingOffset ( |
| 1270 | + _mappings_: a List of Decoded Mapping Records, |
| 1271 | + _offset_: a Decoded Range Mapping Offset Record, |
| 1272 | + ): a Decoded Mapping Record or ~not-found~ |
| 1273 | + </h1> |
| 1274 | + <dl class="header"></dl> |
| 1275 | + <emu-alg> |
| 1276 | + 1. Let _currentLine_ be *null*. |
| 1277 | + 1. Let _currentIndex_ be 0. |
| 1278 | + 1. For each Decoded Mapping Record _mapping_ of _mappings_, do |
| 1279 | + 1. If _currentLine_ ≠ _mapping_.[[GeneratedLine]], then |
| 1280 | + 1. Set _currentLine_ to _mapping_.[[GeneratedLine]]. |
| 1281 | + 1. Set _currentIndex_ to 0. |
| 1282 | + 1. Else, |
| 1283 | + 1. Set _currentIndex_ to _currentIndex_ + 1. |
| 1284 | + 1. If _currentLine_ = _offset_.[[GeneratedLine]] and _currentIndex_ = _offset_.[[MappingIndex]], then |
| 1285 | + 1. Return _mapping_. |
| 1286 | + 1. Return ~not-found~. |
1273 | 1287 | </emu-alg> |
1274 | 1288 | </emu-clause> |
1275 | 1289 | </emu-clause> |
|
0 commit comments