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

Function commitPendingMapping

test/fixtures/snapshot/typescript.js:90179–90222  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

90177 }
90178 }
90179 function commitPendingMapping() {
90180 if (!hasPending || !shouldCommitMapping()) {
90181 return;
90182 }
90183 enter();
90184 // Line/Comma delimiters
90185 if (lastGeneratedLine < pendingGeneratedLine) {
90186 // Emit line delimiters
90187 do {
90188 appendMappingCharCode(59 /* CharacterCodes.semicolon */);
90189 lastGeneratedLine++;
90190 } while (lastGeneratedLine < pendingGeneratedLine);
90191 // Only need to set this once
90192 lastGeneratedCharacter = 0;
90193 }
90194 else {
90195 ts.Debug.assertEqual(lastGeneratedLine, pendingGeneratedLine, "generatedLine cannot backtrack");
90196 // Emit comma to separate the entry
90197 if (hasLast) {
90198 appendMappingCharCode(44 /* CharacterCodes.comma */);
90199 }
90200 }
90201 // 1. Relative generated character
90202 appendBase64VLQ(pendingGeneratedCharacter - lastGeneratedCharacter);
90203 lastGeneratedCharacter = pendingGeneratedCharacter;
90204 if (hasPendingSource) {
90205 // 2. Relative sourceIndex
90206 appendBase64VLQ(pendingSourceIndex - lastSourceIndex);
90207 lastSourceIndex = pendingSourceIndex;
90208 // 3. Relative source line
90209 appendBase64VLQ(pendingSourceLine - lastSourceLine);
90210 lastSourceLine = pendingSourceLine;
90211 // 4. Relative source character
90212 appendBase64VLQ(pendingSourceCharacter - lastSourceCharacter);
90213 lastSourceCharacter = pendingSourceCharacter;
90214 if (hasPendingName) {
90215 // 5. Relative nameIndex
90216 appendBase64VLQ(pendingNameIndex - lastNameIndex);
90217 lastNameIndex = pendingNameIndex;
90218 }
90219 }
90220 hasLast = true;
90221 exit();
90222 }
90223 function flushMappingBuffer() {
90224 if (mappingCharCodes.length > 0) {
90225 mappings += String.fromCharCode.apply(undefined, mappingCharCodes);

Callers 2

addMappingFunction · 0.85
toJSONFunction · 0.85

Calls 5

shouldCommitMappingFunction · 0.85
appendMappingCharCodeFunction · 0.85
appendBase64VLQFunction · 0.85
enterFunction · 0.70
exitFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…