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

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

Issue 1179173005: Schedule unknown priority source analysis. (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 | « no previous file | pkg/analyzer/test/src/task/dart_work_manager_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 6700e1f56d397f06e52d425280ccd9197a750521..0654e3c6bcc757819dc4c17a5409f48de877e651 100644
--- a/pkg/analyzer/lib/src/task/dart_work_manager.dart
+++ b/pkg/analyzer/lib/src/task/dart_work_manager.dart
@@ -158,8 +158,10 @@ class DartWorkManager implements WorkManager {
for (AnalysisTarget target in targets) {
if (_isDartSource(target)) {
SourceKind sourceKind = analysisCache.getValue(target, SOURCE_KIND);
- if (sourceKind == SourceKind.LIBRARY) {
- addPriorityResult(target, LIBRARY_ERRORS_READY);
+ if (sourceKind == SourceKind.UNKNOWN) {
+ addPriorityResult(target, SOURCE_KIND);
+ } else if (sourceKind == SourceKind.LIBRARY) {
+ _schedulePriorityLibrarySourceAnalysis(target);
} else if (sourceKind == SourceKind.PART) {
List<Source> libraries = context.getLibrariesContaining(target);
for (Source library in libraries) {
@@ -269,12 +271,19 @@ class DartWorkManager implements WorkManager {
AnalysisTarget target, Map<ResultDescriptor, dynamic> outputs) {
// Organize sources.
if (_isDartSource(target)) {
+ Source source = target;
SourceKind kind = outputs[SOURCE_KIND];
if (kind != null) {
- unknownSourceQueue.remove(target);
- if (kind == SourceKind.LIBRARY &&
- context.shouldErrorsBeAnalyzed(target, null)) {
- librarySourceQueue.add(target);
+ unknownSourceQueue.remove(source);
+ if (kind == SourceKind.LIBRARY) {
+ if (context.prioritySources.contains(source)) {
+ _schedulePriorityLibrarySourceAnalysis(source);
+ } else {
+ bool needErrors = _shouldErrorsBeComputed(source);
+ if (needErrors) {
+ librarySourceQueue.add(target);
+ }
+ }
}
}
}
@@ -414,6 +423,24 @@ class DartWorkManager implements WorkManager {
_invalidateContainingLibraries(library);
}
+ /**
+ * Schedule computing [RESOLVED_UNIT] for the given [librarySource].
+ * If errors should be computed, then schedule [LIBRARY_ERRORS_READY] instead,
+ * it also computes [RESOLVED_UNIT] in process.
+ */
+ void _schedulePriorityLibrarySourceAnalysis(Source librarySource) {
+ bool needErrors = _shouldErrorsBeComputed(librarySource);
+ if (needErrors) {
+ addPriorityResult(librarySource, LIBRARY_ERRORS_READY);
+ } else {
+ var target = new LibrarySpecificUnit(librarySource, librarySource);
+ addPriorityResult(target, RESOLVED_UNIT);
+ }
+ }
+
+ bool _shouldErrorsBeComputed(Source source) =>
+ context.shouldErrorsBeAnalyzed(source, null);
+
static bool _isDartSource(AnalysisTarget target) {
return target is Source && AnalysisEngine.isDartFileName(target.fullName);
}
« no previous file with comments | « no previous file | pkg/analyzer/test/src/task/dart_work_manager_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698