MCPcopy Index your code
hub / github.com/nodejs/node / decodeMappings

Function decodeMappings

test/fixtures/snapshot/typescript.js:90324–90457  ·  view source on GitHub ↗
(mappings)

Source from the content-addressed store, hash-verified

90322 }
90323 ts.tryParseRawSourceMap = tryParseRawSourceMap;
90324 function decodeMappings(mappings) {
90325 var done = false;
90326 var pos = 0;
90327 var generatedLine = 0;
90328 var generatedCharacter = 0;
90329 var sourceIndex = 0;
90330 var sourceLine = 0;
90331 var sourceCharacter = 0;
90332 var nameIndex = 0;
90333 var error;
90334 return {
90335 get pos() { return pos; },
90336 get error() { return error; },
90337 get state() { return captureMapping(/*hasSource*/ true, /*hasName*/ true); },
90338 next: function () {
90339 while (!done && pos < mappings.length) {
90340 var ch = mappings.charCodeAt(pos);
90341 if (ch === 59 /* CharacterCodes.semicolon */) {
90342 // new line
90343 generatedLine++;
90344 generatedCharacter = 0;
90345 pos++;
90346 continue;
90347 }
90348 if (ch === 44 /* CharacterCodes.comma */) {
90349 // Next entry is on same line - no action needed
90350 pos++;
90351 continue;
90352 }
90353 var hasSource = false;
90354 var hasName = false;
90355 generatedCharacter += base64VLQFormatDecode();
90356 if (hasReportedError())
90357 return stopIterating();
90358 if (generatedCharacter < 0)
90359 return setErrorAndStopIterating("Invalid generatedCharacter found");
90360 if (!isSourceMappingSegmentEnd()) {
90361 hasSource = true;
90362 sourceIndex += base64VLQFormatDecode();
90363 if (hasReportedError())
90364 return stopIterating();
90365 if (sourceIndex < 0)
90366 return setErrorAndStopIterating("Invalid sourceIndex found");
90367 if (isSourceMappingSegmentEnd())
90368 return setErrorAndStopIterating("Unsupported Format: No entries after sourceIndex");
90369 sourceLine += base64VLQFormatDecode();
90370 if (hasReportedError())
90371 return stopIterating();
90372 if (sourceLine < 0)
90373 return setErrorAndStopIterating("Invalid sourceLine found");
90374 if (isSourceMappingSegmentEnd())
90375 return setErrorAndStopIterating("Unsupported Format: No entries after sourceLine");
90376 sourceCharacter += base64VLQFormatDecode();
90377 if (hasReportedError())
90378 return stopIterating();
90379 if (sourceCharacter < 0)
90380 return setErrorAndStopIterating("Invalid sourceCharacter found");
90381 if (!isSourceMappingSegmentEnd()) {

Callers 2

appendSourceMapFunction · 0.85
getDecodedMappingsFunction · 0.85

Calls 6

base64VLQFormatDecodeFunction · 0.85
hasReportedErrorFunction · 0.85
stopIteratingFunction · 0.85
setErrorAndStopIteratingFunction · 0.85
captureMappingFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…