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

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: Address comments 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..c12262d5b0bd406f7dc029e4b2c5c66253493499 100644
--- a/pkg/analyzer/lib/src/context/cache.dart
+++ b/pkg/analyzer/lib/src/context/cache.dart
@@ -216,8 +216,10 @@ class AnalysisCache {
/**
* Remove all information related to the given [target] from this cache.
+ * Return the entry associated with the target, or `null` if there was cache
+ * entry for the target.
*/
- 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 +228,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 +898,11 @@ 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.
+ * Return the entry associated with the target, or `null` if there was cache
+ * entry for the target.
*/
- void remove(AnalysisTarget target) {
+ CacheEntry remove(AnalysisTarget target) {
for (CacheFlushManager flushManager in _flushManagerMap.values) {
flushManager.targetRemoved(target);
}
@@ -907,6 +911,7 @@ abstract class CachePartition {
entry._invalidateAll();
}
_removeIfSource(target);
+ return entry;
}
/**
@@ -981,19 +986,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