| Index: pkg/analyzer/lib/src/context/cache.dart
|
| diff --git a/pkg/analyzer/lib/src/context/cache.dart b/pkg/analyzer/lib/src/context/cache.dart
|
| index ae7961546a45a8f433ac8b2bf88b5b653f4f30fa..fa7fbadc89f83d4eefe032fbcde45e536ac9a83a 100644
|
| --- a/pkg/analyzer/lib/src/context/cache.dart
|
| +++ b/pkg/analyzer/lib/src/context/cache.dart
|
| @@ -17,6 +17,12 @@ import 'package:analyzer/src/task/model.dart';
|
| import 'package:analyzer/task/model.dart';
|
|
|
| /**
|
| + * Return `true` if the [result] of the [target] should be flushed.
|
| + */
|
| +typedef bool FlushResultFilter<V>(
|
| + AnalysisTarget target, ResultDescriptor<V> result);
|
| +
|
| +/**
|
| * Return `true` if the given [target] is a priority one.
|
| */
|
| typedef bool IsPriorityAnalysisTarget(AnalysisTarget target);
|
| @@ -103,6 +109,15 @@ class AnalysisCache {
|
| }
|
|
|
| /**
|
| + * Flush results that satisfy the given [filter].
|
| + */
|
| + void flush(FlushResultFilter filter) {
|
| + for (CachePartition partition in _partitions) {
|
| + partition.flush(filter);
|
| + }
|
| + }
|
| +
|
| + /**
|
| * Return the entry associated with the given [target].
|
| */
|
| CacheEntry get(AnalysisTarget target) {
|
| @@ -392,6 +407,17 @@ class CacheEntry {
|
| }
|
|
|
| /**
|
| + * Flush results that satisfy the given [filter].
|
| + */
|
| + void flush(FlushResultFilter filter) {
|
| + _resultMap.forEach((ResultDescriptor result, ResultData data) {
|
| + if (filter(target, result)) {
|
| + data.flush();
|
| + }
|
| + });
|
| + }
|
| +
|
| + /**
|
| * Return the result data associated with the [descriptor], creating one if it
|
| * isn't there.
|
| */
|
| @@ -998,6 +1024,15 @@ abstract class CachePartition {
|
| }
|
|
|
| /**
|
| + * Flush results that satisfy the given [filter].
|
| + */
|
| + void flush(FlushResultFilter filter) {
|
| + for (CacheEntry entry in entryMap.values) {
|
| + entry.flush(filter);
|
| + }
|
| + }
|
| +
|
| + /**
|
| * Return the entry associated with the given [target].
|
| */
|
| CacheEntry get(AnalysisTarget target) => entryMap[target];
|
|
|