Index: pkg/analyzer/lib/src/generated/engine.dart |
diff --git a/pkg/analyzer/lib/src/generated/engine.dart b/pkg/analyzer/lib/src/generated/engine.dart |
index d62d3a7362b0a8785794ea3c9d1ce3a2eaaff5a4..038ace0d0ed675dfbf964be8b50839d6fbbb5a24 100644 |
--- a/pkg/analyzer/lib/src/generated/engine.dart |
+++ b/pkg/analyzer/lib/src/generated/engine.dart |
@@ -1781,6 +1781,12 @@ class AnalysisContextImpl implements InternalAnalysisContext { |
@override |
void dispose() { |
_disposed = true; |
+ for (List<PendingFuture> pendingFutures in _pendingFutureSources.values) { |
+ for (PendingFuture pendingFuture in pendingFutures) { |
+ pendingFuture.forciblyComplete(); |
+ } |
+ } |
+ _pendingFutureSources.clear(); |
} |
@override |
@@ -14354,6 +14360,11 @@ class _AnalysisFutureHelper<T> { |
*/ |
CancelableFuture<T> computeAsync(Source source, T |
computeValue(SourceEntry sourceEntry)) { |
+ if (_context.isDisposed) { |
+ // No further analysis is expected, so return a future that completes |
+ // immediately with AnalysisNotScheduledError. |
+ return new CancelableFuture.error(new AnalysisNotScheduledError()); |
+ } |
SourceEntry sourceEntry = _context.getReadableSourceEntryOrNull(source); |
if (sourceEntry == null) { |
return new CancelableFuture.error(new AnalysisNotScheduledError()); |