Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(632)

Unified Diff: pkg/analyzer/lib/src/context/cache.dart

Issue 1239863002: Add hook for listening to implicitly analyzed files (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/context/context.dart » ('j') | pkg/analyzer/lib/src/context/context.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
}
}
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/context/context.dart » ('j') | pkg/analyzer/lib/src/context/context.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698