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

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

Issue 1405643002: Issue 24566. Main AnalysisContext.getLibrariesContaining() should work also for SDK sources. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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/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 6f08af207572218dae621f6af1f2bf61e78a48ee..d0341b8a8729355a90c63af2eb41b9af759f2dbb 100644
--- a/pkg/analyzer/lib/src/task/dart_work_manager.dart
+++ b/pkg/analyzer/lib/src/task/dart_work_manager.dart
@@ -193,6 +193,12 @@ class DartWorkManager implements WorkManager {
* Maybe empty, but not null.
*/
List<Source> getLibrariesContainingPart(Source part) {
+ if (part.isInSystemLibrary) {
+ DartWorkManager sdkDartWorkManager = _getSdkDartWorkManager();
+ if (sdkDartWorkManager != this) {
+ return sdkDartWorkManager.getLibrariesContainingPart(part);
+ }
+ }
List<Source> libraries = partLibrariesMap[part];
return libraries != null ? libraries : Source.EMPTY_LIST;
}
@@ -267,15 +273,10 @@ class DartWorkManager implements WorkManager {
bool isDartSource = _isDartSource(target);
// Route SDK outputs to the SDK WorkManager.
if (isDartSource && target.source.isInSystemLibrary) {
- SourceFactory sourceFactory = context.sourceFactory;
- InternalAnalysisContext sdkContext = sourceFactory.dartSdk.context;
- if (sdkContext != context) {
- for (WorkManager sdkWorkManager in sdkContext.workManagers) {
- if (sdkWorkManager is DartWorkManager) {
- sdkWorkManager.resultsComputed(target, outputs);
- return;
- }
- }
+ DartWorkManager sdkWorkManager = _getSdkDartWorkManager();
+ if (sdkWorkManager != this) {
+ sdkWorkManager.resultsComputed(target, outputs);
+ return;
}
}
// Organize sources.
@@ -352,6 +353,22 @@ class DartWorkManager implements WorkManager {
}
/**
+ * Return the SDK [DartWorkManager] or this one.
+ */
+ DartWorkManager _getSdkDartWorkManager() {
+ SourceFactory sourceFactory = context.sourceFactory;
+ InternalAnalysisContext sdkContext = sourceFactory.dartSdk.context;
+ if (sdkContext != context) {
+ for (WorkManager workManager in sdkContext.workManagers) {
+ if (workManager is DartWorkManager) {
+ return workManager;
+ }
+ }
+ }
+ return this;
+ }
+
+ /**
* Invalidate all of the resolution results computed by this context. The flag
* [invalidateUris] should be `true` if the cached results of converting URIs
* to source files should also be invalidated.
« no previous file with comments | « no previous file | pkg/analyzer/test/src/context/context_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698