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

Function getOrCreateSourceFileLike

test/fixtures/snapshot/typescript.js:144607–144621  ·  view source on GitHub ↗
(fileName)

Source from the content-addressed store, hash-verified

144605 return file && file.resolvedPath === path ? file : undefined;
144606 }
144607 function getOrCreateSourceFileLike(fileName) {
144608 var path = toPath(fileName);
144609 var fileFromCache = sourceFileLike.get(path);
144610 if (fileFromCache !== undefined)
144611 return fileFromCache ? fileFromCache : undefined;
144612 if (!host.readFile || host.fileExists && !host.fileExists(path)) {
144613 sourceFileLike.set(path, false);
144614 return undefined;
144615 }
144616 // And failing that, check the disk
144617 var text = host.readFile(path);
144618 var file = text ? createSourceFileLike(text) : false;
144619 sourceFileLike.set(path, file);
144620 return file ? file : undefined;
144621 }
144622 // This can be called from source mapper in either source program or program that includes generated file
144623 function getSourceFileLike(fileName) {
144624 return !host.getSourceFileLike ?

Callers 1

getSourceFileLikeFunction · 0.85

Calls 5

toPathFunction · 0.85
createSourceFileLikeFunction · 0.85
getMethod · 0.65
setMethod · 0.45
readFileMethod · 0.45

Tested by

no test coverage detected