(generatedLine, generatedCharacter, map, sourceMapPath, start, end)
| 90106 | exit(); |
| 90107 | } |
| 90108 | function appendSourceMap(generatedLine, generatedCharacter, map, sourceMapPath, start, end) { |
| 90109 | ts.Debug.assert(generatedLine >= pendingGeneratedLine, "generatedLine cannot backtrack"); |
| 90110 | ts.Debug.assert(generatedCharacter >= 0, "generatedCharacter cannot be negative"); |
| 90111 | enter(); |
| 90112 | // First, decode the old component sourcemap |
| 90113 | var sourceIndexToNewSourceIndexMap = []; |
| 90114 | var nameIndexToNewNameIndexMap; |
| 90115 | var mappingIterator = decodeMappings(map.mappings); |
| 90116 | for (var iterResult = mappingIterator.next(); !iterResult.done; iterResult = mappingIterator.next()) { |
| 90117 | var raw = iterResult.value; |
| 90118 | if (end && (raw.generatedLine > end.line || |
| 90119 | (raw.generatedLine === end.line && raw.generatedCharacter > end.character))) { |
| 90120 | break; |
| 90121 | } |
| 90122 | if (start && (raw.generatedLine < start.line || |
| 90123 | (start.line === raw.generatedLine && raw.generatedCharacter < start.character))) { |
| 90124 | continue; |
| 90125 | } |
| 90126 | // Then reencode all the updated mappings into the overall map |
| 90127 | var newSourceIndex = void 0; |
| 90128 | var newSourceLine = void 0; |
| 90129 | var newSourceCharacter = void 0; |
| 90130 | var newNameIndex = void 0; |
| 90131 | if (raw.sourceIndex !== undefined) { |
| 90132 | newSourceIndex = sourceIndexToNewSourceIndexMap[raw.sourceIndex]; |
| 90133 | if (newSourceIndex === undefined) { |
| 90134 | // Apply offsets to each position and fixup source entries |
| 90135 | var rawPath = map.sources[raw.sourceIndex]; |
| 90136 | var relativePath = map.sourceRoot ? ts.combinePaths(map.sourceRoot, rawPath) : rawPath; |
| 90137 | var combinedPath = ts.combinePaths(ts.getDirectoryPath(sourceMapPath), relativePath); |
| 90138 | sourceIndexToNewSourceIndexMap[raw.sourceIndex] = newSourceIndex = addSource(combinedPath); |
| 90139 | if (map.sourcesContent && typeof map.sourcesContent[raw.sourceIndex] === "string") { |
| 90140 | setSourceContent(newSourceIndex, map.sourcesContent[raw.sourceIndex]); |
| 90141 | } |
| 90142 | } |
| 90143 | newSourceLine = raw.sourceLine; |
| 90144 | newSourceCharacter = raw.sourceCharacter; |
| 90145 | if (map.names && raw.nameIndex !== undefined) { |
| 90146 | if (!nameIndexToNewNameIndexMap) |
| 90147 | nameIndexToNewNameIndexMap = []; |
| 90148 | newNameIndex = nameIndexToNewNameIndexMap[raw.nameIndex]; |
| 90149 | if (newNameIndex === undefined) { |
| 90150 | nameIndexToNewNameIndexMap[raw.nameIndex] = newNameIndex = addName(map.names[raw.nameIndex]); |
| 90151 | } |
| 90152 | } |
| 90153 | } |
| 90154 | var rawGeneratedLine = raw.generatedLine - (start ? start.line : 0); |
| 90155 | var newGeneratedLine = rawGeneratedLine + generatedLine; |
| 90156 | var rawGeneratedCharacter = start && start.line === raw.generatedLine ? raw.generatedCharacter - start.character : raw.generatedCharacter; |
| 90157 | var newGeneratedCharacter = rawGeneratedLine === 0 ? rawGeneratedCharacter + generatedCharacter : rawGeneratedCharacter; |
| 90158 | addMapping(newGeneratedLine, newGeneratedCharacter, newSourceIndex, newSourceLine, newSourceCharacter, newNameIndex); |
| 90159 | } |
| 90160 | exit(); |
| 90161 | } |
| 90162 | function shouldCommitMapping() { |
| 90163 | return !hasLast |
| 90164 | || lastGeneratedLine !== pendingGeneratedLine |
nothing calls this directly
no test coverage detected
searching dependent graphs…