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

Function getDocumentPositionMapper

test/fixtures/snapshot/typescript.js:144552–144567  ·  view source on GitHub ↗
(generatedFileName, sourceFileName)

Source from the content-addressed store, hash-verified

144550 return ts.toPath(fileName, currentDirectory, getCanonicalFileName);
144551 }
144552 function getDocumentPositionMapper(generatedFileName, sourceFileName) {
144553 var path = toPath(generatedFileName);
144554 var value = documentPositionMappers.get(path);
144555 if (value)
144556 return value;
144557 var mapper;
144558 if (host.getDocumentPositionMapper) {
144559 mapper = host.getDocumentPositionMapper(generatedFileName, sourceFileName);
144560 }
144561 else if (host.readFile) {
144562 var file = getSourceFileLike(generatedFileName);
144563 mapper = file && ts.getDocumentPositionMapper({ getSourceFileLike: getSourceFileLike, getCanonicalFileName: getCanonicalFileName, log: function (s) { return host.log(s); } }, generatedFileName, ts.getLineInfo(file.text, ts.getLineStarts(file)), function (f) { return !host.fileExists || host.fileExists(f) ? host.readFile(f) : undefined; });
144564 }
144565 documentPositionMappers.set(path, mapper || ts.identitySourceMapConsumer);
144566 return mapper || ts.identitySourceMapConsumer;
144567 }
144568 function tryGetSourcePosition(info) {
144569 if (!ts.isDeclarationFileName(info.fileName))
144570 return undefined;

Callers 2

tryGetSourcePositionFunction · 0.85
tryGetGeneratedPositionFunction · 0.85

Calls 9

toPathFunction · 0.85
getSourceFileLikeFunction · 0.85
getMethod · 0.65
logMethod · 0.45
readFileMethod · 0.45
setMethod · 0.45
execMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…