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

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: 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..d60f4d8f098a8014ced5f93f6fdb8fdfe9a5dbb1 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 list of analysis errors in compilation units in a specific library.
+ *
+ * The result is only available for [Source]s representing a library.
+ */
+final ListResultDescriptor<AnalysisError> LIBRARY_ERRORS =
+ new ListResultDescriptor<AnalysisError>(
+ 'LIBRARY_ERRORS', AnalysisError.NO_ERRORS);
+
+/**
* 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,62 @@ class GenerateHintsTask extends SourceBasedAnalysisTask {
}
/**
+ * A task that merges all of the errors of all of the units for a single
+ * library source into a single list of errors.
+ */
+class LibraryErrorsTask extends SourceBasedAnalysisTask {
+ /**
+ * The name of the [DART_ERRORS] input.
+ */
+ static const String DART_ERRORS_INPUT = 'ERRORS_INPUT';
+
+ /**
+ * The task descriptor describing this kind of task.
+ */
+ static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
+ 'LibraryErrorsTask', createTask, buildInputs,
+ <ResultDescriptor>[LIBRARY_ERRORS]);
+
+ LibraryErrorsTask(InternalAnalysisContext context, AnalysisTarget target)
+ : super(context, target);
+
+ @override
+ TaskDescriptor get descriptor => DESCRIPTOR;
+
+ @override
+ void internalPerform() {
+ //
+ // Prepare inputs.
+ //
+ List<List<AnalysisError>> errorLists = getRequiredInput(DART_ERRORS_INPUT);
+ //
+ // Record outputs.
+ //
+ outputs[LIBRARY_ERRORS] = AnalysisError.mergeLists(errorLists);
Brian Wilkerson 2015/05/08 22:15:20 I don't think this result is useful for anyone. Pe
scheglov 2015/05/08 23:10:55 Done.
+ }
+
+ /**
+ * 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>{
+ DART_ERRORS_INPUT: UNITS.of(library).toListOf(DART_ERRORS)
+ };
+ }
+
+ /**
+ * Create a [LibraryErrorsTask] based on the given [target] in the given
+ * [context].
+ */
+ static LibraryErrorsTask createTask(
+ AnalysisContext context, AnalysisTarget target) {
+ return new LibraryErrorsTask(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