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

Function onReleaseOldSourceFile

test/fixtures/snapshot/typescript.js:123664–123685  ·  view source on GitHub ↗
(oldSourceFile, _oldOptions, hasSourceFileByPath)

Source from the content-addressed store, hash-verified

123662 return !hostSourceFile || !hostSourceFile.version ? undefined : hostSourceFile.version;
123663 }
123664 function onReleaseOldSourceFile(oldSourceFile, _oldOptions, hasSourceFileByPath) {
123665 var hostSourceFileInfo = sourceFilesCache.get(oldSourceFile.resolvedPath);
123666 // If this is the source file thats in the cache and new program doesnt need it,
123667 // remove the cached entry.
123668 // Note we arent deleting entry if file became missing in new program or
123669 // there was version update and new source file was created.
123670 if (hostSourceFileInfo !== undefined) {
123671 // record the missing file paths so they can be removed later if watchers arent tracking them
123672 if (isFileMissingOnHost(hostSourceFileInfo)) {
123673 (missingFilePathsRequestedForRelease || (missingFilePathsRequestedForRelease = [])).push(oldSourceFile.path);
123674 }
123675 else if (hostSourceFileInfo.sourceFile === oldSourceFile) {
123676 if (hostSourceFileInfo.fileWatcher) {
123677 hostSourceFileInfo.fileWatcher.close();
123678 }
123679 sourceFilesCache.delete(oldSourceFile.resolvedPath);
123680 if (!hasSourceFileByPath) {
123681 resolutionCache.removeResolutionsOfFile(oldSourceFile.path);
123682 }
123683 }
123684 }
123685 }
123686 function reportWatchDiagnostic(message) {
123687 if (host.onWatchStatusChange) {
123688 host.onWatchStatusChange(ts.createCompilerDiagnostic(message), newLine, compilerOptions || optionsToExtendForConfigFile);

Callers 1

Calls 5

isFileMissingOnHostFunction · 0.85
getMethod · 0.65
closeMethod · 0.65
deleteMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected