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

Function getSourcePosition

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

Source from the content-addressed store, hash-verified

90609 return { fileName: generatedAbsoluteFilePath, pos: mapping.generatedPosition }; // Closest pos
90610 }
90611 function getSourcePosition(loc) {
90612 var generatedMappings = getGeneratedMappings();
90613 if (!ts.some(generatedMappings))
90614 return loc;
90615 var targetIndex = ts.binarySearchKey(generatedMappings, loc.pos, getGeneratedPositionOfMapping, ts.compareValues);
90616 if (targetIndex < 0) {
90617 // if no exact match, closest is 2's complement of result
90618 targetIndex = ~targetIndex;
90619 }
90620 var mapping = generatedMappings[targetIndex];
90621 if (mapping === undefined || !isSourceMappedPosition(mapping)) {
90622 return loc;
90623 }
90624 return { fileName: sourceFileAbsolutePaths[mapping.sourceIndex], pos: mapping.sourcePosition }; // Closest pos
90625 }
90626 }
90627 ts.createDocumentPositionMapper = createDocumentPositionMapper;
90628 ts.identitySourceMapConsumer = {

Callers

nothing calls this directly

Calls 3

getGeneratedMappingsFunction · 0.85
isSourceMappedPositionFunction · 0.85
someMethod · 0.80

Tested by

no test coverage detected