Chromium Code Reviews| 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 0d67817f80ab56763b9737666b361f1640b8b793..adb7b6d2efb23a3f313a63222aa5123f1fd059c1 100644 |
| --- a/pkg/analyzer/lib/src/context/cache.dart |
| +++ b/pkg/analyzer/lib/src/context/cache.dart |
| @@ -215,9 +215,10 @@ class AnalysisCache { |
| } |
| /** |
| - * Remove all information related to the given [target] from this cache. |
| + * Remove all information related to the given [target] from this cache and |
| + * return the entry associated with the target. |
|
Paul Berry
2015/07/15 19:50:01
Let's also document the fact that we return `null`
Brian Wilkerson
2015/07/15 21:23:37
Done
|
| */ |
| - void remove(AnalysisTarget target) { |
| + CacheEntry remove(AnalysisTarget target) { |
| int count = _partitions.length; |
| for (int i = 0; i < count; i++) { |
| CachePartition partition = _partitions[i]; |
| @@ -226,10 +227,10 @@ class AnalysisCache { |
| AnalysisEngine.instance.logger |
| .logInformation('Removed the cache entry for $target.'); |
| } |
| - partition.remove(target); |
| - return; |
| + return partition.remove(target); |
| } |
| } |
| + return null; |
| } |
| /** |
| @@ -896,9 +897,10 @@ abstract class CachePartition { |
| } |
| /** |
| - * Remove all information related to the given [target] from this cache. |
| + * Remove all information related to the given [target] from this partition |
| + * and return the entry associated with the target. |
|
Paul Berry
2015/07/15 19:50:01
Similar comment here.
Brian Wilkerson
2015/07/15 21:23:37
Done
|
| */ |
| - void remove(AnalysisTarget target) { |
| + CacheEntry remove(AnalysisTarget target) { |
| for (CacheFlushManager flushManager in _flushManagerMap.values) { |
| flushManager.targetRemoved(target); |
| } |
| @@ -907,6 +909,7 @@ abstract class CachePartition { |
| entry._invalidateAll(); |
| } |
| _removeIfSource(target); |
| + return entry; |
| } |
| /** |
| @@ -981,19 +984,17 @@ abstract class CachePartition { |
| } |
| /** |
| - * If the given [target] is a [Source], removes it from [_sources]. |
| + * If the given [target] is a [Source], remove it from the list of [_sources]. |
| */ |
| void _removeIfSource(AnalysisTarget target) { |
| if (target is Source) { |
| _sources.remove(target); |
| - { |
| - String fullName = target.fullName; |
| - List<Source> sources = _pathToSources[fullName]; |
| - if (sources != null) { |
| - sources.remove(target); |
| - if (sources.isEmpty) { |
| - _pathToSources.remove(fullName); |
| - } |
| + String fullName = target.fullName; |
| + List<Source> sources = _pathToSources[fullName]; |
| + if (sources != null) { |
| + sources.remove(target); |
| + if (sources.isEmpty) { |
| + _pathToSources.remove(fullName); |
| } |
| } |
| } |