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

Function loadWithTypeDirectiveCache

test/fixtures/snapshot/typescript.js:116170–116192  ·  view source on GitHub ↗
(names, containingFile, redirectedReference, containingFileMode, loader)

Source from the content-addressed store, hash-verified

116168 ts.flattenDiagnosticMessageText = flattenDiagnosticMessageText;
116169 /* @internal */
116170 function loadWithTypeDirectiveCache(names, containingFile, redirectedReference, containingFileMode, loader) {
116171 if (names.length === 0) {
116172 return [];
116173 }
116174 var resolutions = [];
116175 var cache = new ts.Map();
116176 for (var _i = 0, names_2 = names; _i < names_2.length; _i++) {
116177 var name = names_2[_i];
116178 var result = void 0;
116179 var mode = getModeForFileReference(name, containingFileMode);
116180 // We lower-case all type references because npm automatically lowercases all packages. See GH#9824.
116181 var strName = ts.isString(name) ? name : name.fileName.toLowerCase();
116182 var cacheKey = mode !== undefined ? "".concat(mode, "|").concat(strName) : strName;
116183 if (cache.has(cacheKey)) {
116184 result = cache.get(cacheKey);
116185 }
116186 else {
116187 cache.set(cacheKey, result = loader(strName, containingFile, redirectedReference, mode));
116188 }
116189 resolutions.push(result);
116190 }
116191 return resolutions;
116192 }
116193 ts.loadWithTypeDirectiveCache = loadWithTypeDirectiveCache;
116194 ;
116195 /**

Callers 1

createProgramFunction · 0.85

Calls 7

getModeForFileReferenceFunction · 0.85
concatMethod · 0.80
loaderFunction · 0.70
hasMethod · 0.65
getMethod · 0.65
setMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…