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

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

Issue 1133703003: Add LIBRARY_ERRORS result. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Replace LIBRARY_ERRORS with the LIBRARY_ERRORS_READY flag. Created 5 years, 7 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/plugin/engine_plugin.dart ('k') | pkg/analyzer/test/src/task/dart_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.dart
diff --git a/pkg/analyzer/lib/src/task/dart.dart b/pkg/analyzer/lib/src/task/dart.dart
index 3e1240992993b5af6f5cf7d2c488acd4e2812daf..d3e947caf68e03e332420caa18342d86bf45530b 100644
--- a/pkg/analyzer/lib/src/task/dart.dart
+++ b/pkg/analyzer/lib/src/task/dart.dart
@@ -226,6 +226,15 @@ final ResultDescriptor<LibraryElement> LIBRARY_ELEMENT5 =
cachingPolicy: ELEMENT_CACHING_POLICY);
/**
+ * The flag specifying whether all analysis errors are computed in a specific
+ * library.
+ *
+ * The result is only available for [Source]s representing a library.
+ */
+final ResultDescriptor<bool> LIBRARY_ERRORS_READY =
+ new ResultDescriptor<bool>('LIBRARY_ERRORS_READY', false);
+
+/**
* The analysis errors associated with a compilation unit in a specific library.
*
* The result is only available for [LibrarySpecificUnit]s.
@@ -609,10 +618,7 @@ class BuildCompilationUnitElementTask extends SourceBasedAnalysisTask {
*/
static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
'BuildCompilationUnitElementTask', createTask, buildInputs,
- <ResultDescriptor>[
- COMPILATION_UNIT_ELEMENT,
- RESOLVED_UNIT1
- ]);
+ <ResultDescriptor>[COMPILATION_UNIT_ELEMENT, RESOLVED_UNIT1]);
/**
* Initialize a newly created task to build a compilation unit element for
@@ -2256,6 +2262,50 @@ class GenerateHintsTask extends SourceBasedAnalysisTask {
}
/**
+ * A task computes all of the errors of all of the units for a single
+ * library source and sets the [LIBRARY_ERRORS_READY] flag.
+ */
+class LibraryErrorsReadyTask extends SourceBasedAnalysisTask {
+ /**
+ * The task descriptor describing this kind of task.
+ */
+ static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
+ 'LibraryErrorsReadyTask', createTask, buildInputs,
+ <ResultDescriptor>[LIBRARY_ERRORS_READY]);
+
+ LibraryErrorsReadyTask(InternalAnalysisContext context, AnalysisTarget target)
+ : super(context, target);
+
+ @override
+ TaskDescriptor get descriptor => DESCRIPTOR;
+
+ @override
+ void internalPerform() {
+ outputs[LIBRARY_ERRORS_READY] = true;
+ }
+
+ /**
+ * Return a map from the names of the inputs of this kind of task to the task
+ * input descriptors describing those inputs for a task with the
+ * given [library].
+ */
+ static Map<String, TaskInput> buildInputs(Source library) {
+ return <String, TaskInput>{
+ 'allErrors': UNITS.of(library).toListOf(DART_ERRORS)
+ };
+ }
+
+ /**
+ * Create a [LibraryErrorsReadyTask] based on the given [target] in the given
+ * [context].
+ */
+ static LibraryErrorsReadyTask createTask(
+ AnalysisContext context, AnalysisTarget target) {
+ return new LibraryErrorsReadyTask(context, target);
+ }
+}
+
+/**
* A task that merges all of the errors for a single source into a single list
* of errors.
*/
« no previous file with comments | « pkg/analyzer/lib/src/plugin/engine_plugin.dart ('k') | pkg/analyzer/test/src/task/dart_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698