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

Unified Diff: pkg/analyzer/lib/src/task/dart_work_manager.dart

Issue 1160873004: Only units with 'part of' and no other directives are parts. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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 | « pkg/analyzer/lib/src/task/dart.dart ('k') | pkg/analyzer/test/src/context/context_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/task/dart_work_manager.dart
diff --git a/pkg/analyzer/lib/src/task/dart_work_manager.dart b/pkg/analyzer/lib/src/task/dart_work_manager.dart
index e988f1c8e0aafac7b01a13259e1430526642d276..6df4c7e68ef7a15ca3213da1d03b320e6c31583d 100644
--- a/pkg/analyzer/lib/src/task/dart_work_manager.dart
+++ b/pkg/analyzer/lib/src/task/dart_work_manager.dart
@@ -263,25 +263,12 @@ class DartWorkManager implements WorkManager {
List<Source> includedParts = outputs[INCLUDED_PARTS];
if (includedParts != null) {
libraryPartsMap[library] = includedParts;
- // update contanining libraries
for (Source part in includedParts) {
List<Source> libraries =
partLibrariesMap.putIfAbsent(part, () => <Source>[]);
if (!libraries.contains(library)) {
libraries.add(library);
- }
- }
- // all of the "includedParts" are not libraries anymore
- for (Source part in includedParts) {
- unknownSourceQueue.remove(part);
- librarySourceQueue.remove(part);
- analysisCache.remove(new LibrarySpecificUnit(part, part));
- CacheEntry partEntry = analysisCache.get(part);
- if (partEntry != null) {
- partEntry.setValue(SOURCE_KIND, SourceKind.PART, <TargetedResult>[
- new TargetedResult(part, CONTENT),
- new TargetedResult(target, CONTENT)
- ]);
+ _invalidateContainingLibraries(part);
}
}
}
@@ -324,6 +311,19 @@ class DartWorkManager implements WorkManager {
}
/**
+ * Invalidate [CONTAINING_LIBRARIES] for the given [source].
+ * [CONTAINING_LIBRARIES] does not have dependencies, so we manage it here.
+ * The [source] may be a part, or a library whose contents is updated so
+ * will be a part.
+ */
+ void _invalidateContainingLibraries(Source source) {
+ CacheEntry entry = analysisCache.get(source);
+ if (entry != null) {
+ entry.setState(CONTAINING_LIBRARIES, CacheState.INVALID);
+ }
+ }
+
+ /**
* Returns `true` if the given [result] of the given [target] needs
* computing, i.e. it is not in the valid and not in the error state.
*/
@@ -343,9 +343,11 @@ class DartWorkManager implements WorkManager {
List<Source> libraries = partLibrariesMap[part];
if (libraries != null) {
libraries.remove(library);
+ _invalidateContainingLibraries(part);
Brian Wilkerson 2015/06/04 20:45:56 I think this does too much. If a file 'part.dart'
scheglov 2015/06/04 20:50:27 Yes, we will lose it in the cache. So, ContainingL
}
}
}
+ _invalidateContainingLibraries(library);
}
static bool _isDartSource(AnalysisTarget target) {
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | pkg/analyzer/test/src/context/context_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698