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 499e3fa70f8921c770e653756b2e672e57925aa4..3a23501b1d694ef00a532fa51be769e0dadaf677 100644 |
--- a/pkg/front_end/lib/src/incremental_kernel_generator_impl.dart |
+++ b/pkg/front_end/lib/src/incremental_kernel_generator_impl.dart |
@@ -282,14 +282,18 @@ class IncrementalKernelGeneratorImpl implements IncrementalKernelGenerator { |
/// Refresh all the invalidated files and update dependencies. |
Future<Null> _refreshInvalidatedFiles() async { |
await _logger.runAsync('Refresh invalidated files', () async { |
- for (var fileUri in _invalidatedFiles) { |
+ // Create a copy to avoid concurrent modifications. |
+ var invalidatedFiles = _invalidatedFiles.toList(); |
+ _invalidatedFiles.clear(); |
+ |
+ // Refresh the files. |
+ for (var fileUri in invalidatedFiles) { |
var file = _fsState.getFileByFileUri(fileUri); |
if (file != null) { |
_logger.writeln('Refresh $fileUri'); |
await file.refresh(); |
} |
} |
- _invalidatedFiles.clear(); |
}); |
} |