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

Function getSourceFile

test/fixtures/snapshot/typescript.js:115783–115798  ·  view source on GitHub ↗
(fileName, languageVersionOrOptions, onError)

Source from the content-addressed store, hash-verified

115781 var getCanonicalFileName = ts.createGetCanonicalFileName(system.useCaseSensitiveFileNames);
115782 var computeHash = ts.maybeBind(system, system.createHash) || ts.generateDjb2Hash;
115783 function getSourceFile(fileName, languageVersionOrOptions, onError) {
115784 var text;
115785 try {
115786 ts.performance.mark("beforeIORead");
115787 text = compilerHost.readFile(fileName);
115788 ts.performance.mark("afterIORead");
115789 ts.performance.measure("I/O Read", "beforeIORead", "afterIORead");
115790 }
115791 catch (e) {
115792 if (onError) {
115793 onError(e.message);
115794 }
115795 text = "";
115796 }
115797 return text !== undefined ? ts.createSourceFile(fileName, text, languageVersionOrOptions, setParentNodes) : undefined;
115798 }
115799 function directoryExists(directoryPath) {
115800 if (existingDirectories.has(directoryPath)) {
115801 return true;

Calls 6

getSourceFileByPathFunction · 0.85
toPathFunction · 0.85
measureMethod · 0.80
onErrorFunction · 0.70
markMethod · 0.45
readFileMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…