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

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

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.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 | « packages/analyzer/lib/src/task/dart.dart ('k') | packages/analyzer/lib/src/task/driver.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/analyzer/lib/src/task/dart_work_manager.dart
diff --git a/analyzer/lib/src/task/dart_work_manager.dart b/packages/analyzer/lib/src/task/dart_work_manager.dart
similarity index 92%
rename from analyzer/lib/src/task/dart_work_manager.dart
rename to packages/analyzer/lib/src/task/dart_work_manager.dart
index c02d5947da900b2c1798caf1c673e9f894967cbb..7114053c19154f602d072ceb22e691bc2a3605bb 100644
--- a/analyzer/lib/src/task/dart_work_manager.dart
+++ b/packages/analyzer/lib/src/task/dart_work_manager.dart
@@ -19,9 +19,8 @@ import 'package:analyzer/src/generated/error.dart';
import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/generated/utilities_collection.dart';
import 'package:analyzer/src/task/dart.dart';
-import 'package:analyzer/src/task/driver.dart';
+import 'package:analyzer/src/task/html.dart';
import 'package:analyzer/task/dart.dart';
-import 'package:analyzer/task/general.dart';
import 'package:analyzer/task/model.dart';
/**
@@ -43,8 +42,10 @@ class DartWorkManager implements WorkManager {
*/
static final List<ResultDescriptor> _UNIT_ERRORS = <ResultDescriptor>[
HINTS,
- RESOLVE_REFERENCES_ERRORS,
+ LINTS,
+ LIBRARY_UNIT_ERRORS,
RESOLVE_TYPE_NAMES_ERRORS,
+ RESOLVE_UNIT_ERRORS,
VARIABLE_REFERENCE_ERRORS,
VERIFY_ERRORS
];
@@ -113,9 +114,7 @@ class DartWorkManager implements WorkManager {
priorityResultQueue.add(new TargetedResult(target, result));
}
- /**
- * Notifies the manager about changes in the explicit source list.
- */
+ @override
void applyChange(List<Source> addedSources, List<Source> changedSources,
List<Source> removedSources) {
addedSources = addedSources.where(_isDartSource).toList();
@@ -166,18 +165,16 @@ class DartWorkManager implements WorkManager {
}
}
- /**
- * Return an [AnalysisErrorInfo] containing the list of all of the errors and
- * the line info associated with the given [source]. The list of errors will
- * be empty if the source is not known to the context or if there are no
- * errors in the source. The errors contained in the list can be incomplete.
- */
- AnalysisErrorInfo getErrors(Source source) {
+ @override
+ List<AnalysisError> getErrors(Source source) {
+ if (!_isDartSource(source) && source is! DartScript) {
+ return AnalysisError.NO_ERRORS;
+ }
+ // If analysis is finished, use all the errors.
if (analysisCache.getState(source, DART_ERRORS) == CacheState.VALID) {
- List<AnalysisError> errors = analysisCache.getValue(source, DART_ERRORS);
- LineInfo lineInfo = analysisCache.getValue(source, LINE_INFO);
- return new AnalysisErrorInfoImpl(errors, lineInfo);
+ return analysisCache.getValue(source, DART_ERRORS);
}
+ // If analysis is in progress, combine all known partial results.
List<AnalysisError> errors = <AnalysisError>[];
for (ResultDescriptor descriptor in _SOURCE_ERRORS) {
errors.addAll(analysisCache.getValue(source, descriptor));
@@ -188,8 +185,7 @@ class DartWorkManager implements WorkManager {
errors.addAll(analysisCache.getValue(unit, descriptor));
}
}
- LineInfo lineInfo = analysisCache.getValue(source, LINE_INFO);
- return new AnalysisErrorInfoImpl(errors, lineInfo);
+ return errors;
}
/**
@@ -268,13 +264,16 @@ class DartWorkManager implements WorkManager {
@override
void resultsComputed(
AnalysisTarget target, Map<ResultDescriptor, dynamic> outputs) {
+ bool isDartSource = _isDartSource(target);
// Organize sources.
- if (_isDartSource(target)) {
+ bool isDartLibrarySource = false;
+ if (isDartSource) {
Source source = target;
SourceKind kind = outputs[SOURCE_KIND];
if (kind != null) {
unknownSourceQueue.remove(source);
if (kind == SourceKind.LIBRARY) {
+ isDartLibrarySource = true;
if (context.prioritySources.contains(source)) {
_schedulePriorityLibrarySourceAnalysis(source);
} else {
@@ -287,7 +286,7 @@ class DartWorkManager implements WorkManager {
}
}
// Update parts in libraries.
- if (_isDartSource(target)) {
+ if (isDartLibrarySource) {
Source library = target;
List<Source> includedParts = outputs[INCLUDED_PARTS];
if (includedParts != null) {
@@ -303,7 +302,7 @@ class DartWorkManager implements WorkManager {
}
}
// Update notice.
- if (_isDartSource(target)) {
+ if (isDartSource) {
bool shouldSetErrors = false;
outputs.forEach((ResultDescriptor descriptor, value) {
if (descriptor == PARSED_UNIT && value != null) {
@@ -315,7 +314,7 @@ class DartWorkManager implements WorkManager {
}
});
if (shouldSetErrors) {
- AnalysisErrorInfo info = getErrors(target);
+ AnalysisErrorInfo info = context.getErrors(target);
context.getNotice(target).setErrors(info.errors, info.lineInfo);
}
}
@@ -329,7 +328,7 @@ class DartWorkManager implements WorkManager {
}
});
if (shouldSetErrors) {
- AnalysisErrorInfo info = getErrors(source);
+ AnalysisErrorInfo info = context.getErrors(source);
context.getNotice(source).setErrors(info.errors, info.lineInfo);
}
}
« no previous file with comments | « packages/analyzer/lib/src/task/dart.dart ('k') | packages/analyzer/lib/src/task/driver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698