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

Unified Diff: pkg/analyzer/lib/src/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/manager.dart ('k') | pkg/analyzer/lib/src/task/options.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/task/model.dart
diff --git a/pkg/analyzer/lib/src/task/model.dart b/pkg/analyzer/lib/src/task/model.dart
index b0a6ee67b71f145afa9a5cb967806085144311ff..56e28278a5c41fceb7581403c704e1dbc6a99051 100644
--- a/pkg/analyzer/lib/src/task/model.dart
+++ b/pkg/analyzer/lib/src/task/model.dart
@@ -126,10 +126,10 @@ class TaskDescriptorImpl implements TaskDescriptor {
final List<ResultDescriptor> results;
/**
- * The function used to determine whether the described task is appropriate
- * for a given target.
+ * The function used to determine whether the described task is suitable for
+ * a given target.
*/
- final IsAppropriateFor _isAppropriateFor;
+ final SuitabilityFor _suitabilityFor;
/**
* Initialize a newly created task descriptor to have the given [name] and to
@@ -141,8 +141,8 @@ class TaskDescriptorImpl implements TaskDescriptor {
*/
TaskDescriptorImpl(
this.name, this.buildTask, this.createTaskInputs, this.results,
- {IsAppropriateFor isAppropriateFor})
- : _isAppropriateFor = isAppropriateFor ?? _alwaysTrue;
+ {SuitabilityFor suitabilityFor})
+ : _suitabilityFor = suitabilityFor ?? _defaultSuitability;
@override
AnalysisTask createTask(AnalysisContext context, AnalysisTarget target,
@@ -153,14 +153,16 @@ class TaskDescriptorImpl implements TaskDescriptor {
}
@override
- bool isAppropriateFor(AnalysisTarget target) => _isAppropriateFor(target);
+ TaskSuitability suitabilityFor(AnalysisTarget target) =>
+ _suitabilityFor(target);
@override
String toString() => name;
/**
- * The function that will be used to determine whether a task can be applied
- * to a given target if no other function is provided.
+ * The function that will be used to determine the suitability of a task if no
+ * other function is provided.
*/
- static bool _alwaysTrue(AnalysisTarget target) => true;
+ static TaskSuitability _defaultSuitability(AnalysisTarget target) =>
+ TaskSuitability.LOWEST;
}
« no previous file with comments | « pkg/analyzer/lib/src/task/manager.dart ('k') | pkg/analyzer/lib/src/task/options.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698