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

Function getGeneratedPosition

test/fixtures/snapshot/typescript.js:90593–90610  ·  view source on GitHub ↗
(loc)

Source from the content-addressed store, hash-verified

90591 return generatedMappings;
90592 }
90593 function getGeneratedPosition(loc) {
90594 var sourceIndex = sourceToSourceIndexMap.get(host.getCanonicalFileName(loc.fileName));
90595 if (sourceIndex === undefined)
90596 return loc;
90597 var sourceMappings = getSourceMappings(sourceIndex);
90598 if (!ts.some(sourceMappings))
90599 return loc;
90600 var targetIndex = ts.binarySearchKey(sourceMappings, loc.pos, getSourcePositionOfMapping, ts.compareValues);
90601 if (targetIndex < 0) {
90602 // if no exact match, closest is 2's complement of result
90603 targetIndex = ~targetIndex;
90604 }
90605 var mapping = sourceMappings[targetIndex];
90606 if (mapping === undefined || mapping.sourceIndex !== sourceIndex) {
90607 return loc;
90608 }
90609 return { fileName: generatedAbsoluteFilePath, pos: mapping.generatedPosition }; // Closest pos
90610 }
90611 function getSourcePosition(loc) {
90612 var generatedMappings = getGeneratedMappings();
90613 if (!ts.some(generatedMappings))

Callers

nothing calls this directly

Calls 3

getSourceMappingsFunction · 0.85
someMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected