Merge pull request #359 from Microsoft/cleanup

Wire cleanupSemanticCache
This commit is contained in:
Mohamed Hegazy 2014-08-04 19:06:18 -07:00
commit 97987b1c3e

View file

@ -1299,7 +1299,7 @@ module ts {
if (programUpToDate()) { if (programUpToDate()) {
return; return;
} }
var compilationSettings = hostCache.compilationSettings(); var compilationSettings = hostCache.compilationSettings();
// Now, remove any files from the compiler that are no longer in the host. // Now, remove any files from the compiler that are no longer in the host.
@ -1372,6 +1372,15 @@ module ts {
typeChecker = program.getTypeChecker(); typeChecker = program.getTypeChecker();
} }
/// Clean up any semantic caches that are not needed.
/// The host can call this method if it wants to jettison unused memory.
/// We will just dump the typeChecker and recreate a new one. this should have the effect of destroying all the semantic caches.
function cleanupSemanticCache(): void {
if (program) {
typeChecker = program.getTypeChecker();
}
}
function dispose(): void { function dispose(): void {
if (program) { if (program) {
forEach(program.getSourceFiles(), forEach(program.getSourceFiles(),
@ -2180,7 +2189,7 @@ module ts {
return { return {
dispose: dispose, dispose: dispose,
refresh: () => { }, refresh: () => { },
cleanupSemanticCache: () => { }, cleanupSemanticCache: cleanupSemanticCache,
getSyntacticDiagnostics: getSyntacticDiagnostics, getSyntacticDiagnostics: getSyntacticDiagnostics,
getSemanticDiagnostics: getSemanticDiagnostics, getSemanticDiagnostics: getSemanticDiagnostics,
getCompilerOptionsDiagnostics: getCompilerOptionsDiagnostics, getCompilerOptionsDiagnostics: getCompilerOptionsDiagnostics,