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

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

Issue 1645643002: Replace isAppropriateFor with suitabilityFor and start using it (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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/task/yaml.dart ('k') | pkg/analyzer/lib/task/yaml.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/task/model.dart
diff --git a/pkg/analyzer/lib/task/model.dart b/pkg/analyzer/lib/task/model.dart
index e3f77847bcb1f4d322b86b718c7cd318192436c7..58e095bca1f413af86902aeedde3aebb2030d9d3 100644
--- a/pkg/analyzer/lib/task/model.dart
+++ b/pkg/analyzer/lib/task/model.dart
@@ -37,11 +37,11 @@ typedef Map<String, TaskInput> CreateTaskInputs(AnalysisTarget target);
/**
* A function that takes the target for which a task will produce results and
- * returns `true` if the task is appropriate for the target. Such functions are
- * passed to a [TaskDescriptor] to be used to determine the inputs needed by the
- * task.
+ * returns an indication of how suitable the task is for the target. Such
+ * functions are passed to a [TaskDescriptor] to be used to determine their
+ * suitability for computing results.
*/
-typedef bool IsAppropriateFor(AnalysisTarget target);
+typedef TaskSuitability SuitabilityFor(AnalysisTarget target);
/**
* A function that converts an object of the type [B] into a [TaskInput].
@@ -537,7 +537,7 @@ abstract class TaskDescriptor {
*/
factory TaskDescriptor(String name, BuildTask buildTask,
CreateTaskInputs inputBuilder, List<ResultDescriptor> results,
- {IsAppropriateFor isAppropriateFor}) = TaskDescriptorImpl;
+ {SuitabilityFor suitabilityFor}) = TaskDescriptorImpl;
/**
* Return the builder used to build the inputs to the task.
@@ -562,9 +562,9 @@ abstract class TaskDescriptor {
Map<String, dynamic> inputs);
/**
- * Return `true` if this task is appropriate for the given [target].
+ * Return an indication of how suitable this task is for the given [target].
*/
- bool isAppropriateFor(AnalysisTarget target);
+ TaskSuitability suitabilityFor(AnalysisTarget target);
}
/**
@@ -663,6 +663,11 @@ abstract class TaskInputBuilder<V> {
}
/**
+ * An indication of how suitable a task is for a given target.
+ */
+enum TaskSuitability { NONE, LOWEST, HIGHEST }
+
+/**
* [WorkManager]s are used to drive analysis.
*
* They know specific of the targets and results they care about,
« no previous file with comments | « pkg/analyzer/lib/src/task/yaml.dart ('k') | pkg/analyzer/lib/task/yaml.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698