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

Function tryGetGeneratedPosition

test/fixtures/snapshot/typescript.js:144577–144597  ·  view source on GitHub ↗
(info)

Source from the content-addressed store, hash-verified

144575 return !newLoc || newLoc === info ? undefined : tryGetSourcePosition(newLoc) || newLoc;
144576 }
144577 function tryGetGeneratedPosition(info) {
144578 if (ts.isDeclarationFileName(info.fileName))
144579 return undefined;
144580 var sourceFile = getSourceFile(info.fileName);
144581 if (!sourceFile)
144582 return undefined;
144583 var program = host.getProgram();
144584 // If this is source file of project reference source (instead of redirect) there is no generated position
144585 if (program.isSourceOfProjectReferenceRedirect(sourceFile.fileName)) {
144586 return undefined;
144587 }
144588 var options = program.getCompilerOptions();
144589 var outPath = ts.outFile(options);
144590 var declarationPath = outPath ?
144591 ts.removeFileExtension(outPath) + ".d.ts" /* Extension.Dts */ :
144592 ts.getDeclarationEmitOutputFilePathWorker(info.fileName, program.getCompilerOptions(), currentDirectory, program.getCommonSourceDirectory(), getCanonicalFileName);
144593 if (declarationPath === undefined)
144594 return undefined;
144595 var newLoc = getDocumentPositionMapper(declarationPath, info.fileName).getGeneratedPosition(info);
144596 return newLoc === info ? undefined : newLoc;
144597 }
144598 function getSourceFile(fileName) {
144599 var program = host.getProgram();
144600 if (!program)

Callers

nothing calls this directly

Calls 2

getSourceFileFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…