Index: pkg/front_end/lib/src/incremental_kernel_generator_impl.dart |
diff --git a/pkg/front_end/lib/src/incremental_kernel_generator_impl.dart b/pkg/front_end/lib/src/incremental_kernel_generator_impl.dart |
index 416f22ae151cf02021d1c738651fb6ae5fe2d564..7d320f7c701fc55bd5df039f58c07a04aec8f397 100644 |
--- a/pkg/front_end/lib/src/incremental_kernel_generator_impl.dart |
+++ b/pkg/front_end/lib/src/incremental_kernel_generator_impl.dart |
@@ -60,6 +60,9 @@ class IncrementalKernelGeneratorImpl implements IncrementalKernelGenerator { |
/// The URI of the program entry point. |
final Uri _entryPoint; |
+ /// The function to notify when files become used or unused, or `null`. |
+ final WatchUsedFilesFn _watchFn; |
+ |
/// The salt to mix into all hashes used as keys for serialized data. |
List<int> _salt; |
@@ -77,12 +80,13 @@ class IncrementalKernelGeneratorImpl implements IncrementalKernelGenerator { |
this._options, this._uriTranslator, this._entryPoint, |
{WatchUsedFilesFn watch}) |
: _logger = _options.logger, |
- _byteStore = _options.byteStore { |
+ _byteStore = _options.byteStore, |
+ _watchFn = watch { |
_computeSalt(); |
Future<Null> onFileAdded(Uri uri) { |
- if (watch != null) { |
- return watch(uri, true); |
+ if (_watchFn != null) { |
+ return _watchFn(uri, true); |
} |
return new Future.value(); |
} |
@@ -314,7 +318,12 @@ class IncrementalKernelGeneratorImpl implements IncrementalKernelGenerator { |
} |
// The file graph might have changed, perform GC. |
- _fsState.gc(_entryPoint); |
+ var removedFiles = _fsState.gc(_entryPoint); |
+ if (removedFiles.isNotEmpty && _watchFn != null) { |
+ for (var removedFile in removedFiles) { |
+ await _watchFn(removedFile.fileUri, false); |
+ } |
+ } |
}); |
} |