MCPcopy Create free account
hub / github.com/nodejs/node / getAndCacheDiagnostics

Function getAndCacheDiagnostics

test/fixtures/snapshot/typescript.js:117910–117926  ·  view source on GitHub ↗
(sourceFile, cancellationToken, cache, getDiagnostics)

Source from the content-addressed store, hash-verified

117908 });
117909 }
117910 function getAndCacheDiagnostics(sourceFile, cancellationToken, cache, getDiagnostics) {
117911 var _a;
117912 var cachedResult = sourceFile
117913 ? (_a = cache.perFile) === null || _a === void 0 ? void 0 : _a.get(sourceFile.path)
117914 : cache.allDiagnostics;
117915 if (cachedResult) {
117916 return cachedResult;
117917 }
117918 var result = getDiagnostics(sourceFile, cancellationToken);
117919 if (sourceFile) {
117920 (cache.perFile || (cache.perFile = new ts.Map())).set(sourceFile.path, result);
117921 }
117922 else {
117923 cache.allDiagnostics = result;
117924 }
117925 return result;
117926 }
117927 function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) {
117928 return sourceFile.isDeclarationFile ? [] : getDeclarationDiagnosticsWorker(sourceFile, cancellationToken);
117929 }

Calls 3

getDiagnosticsFunction · 0.85
getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected