Chromium Code Reviews| 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 8eaa83896b18585eb46ec6161348dabaedc33ccf..8021f3ea7f8d23a166f5f6a62d315be16f7c0e05 100644 |
| --- a/pkg/analyzer/lib/src/task/model.dart |
| +++ b/pkg/analyzer/lib/src/task/model.dart |
| @@ -126,13 +126,21 @@ class TaskDescriptorImpl implements TaskDescriptor { |
| final List<ResultDescriptor> results; |
| /** |
| + * The function used to determine whether the described task is appropriate |
| + * for a given target. |
| + */ |
| + final IsAppropriateFor _isAppropriateFor; |
| + |
| + /** |
| * Initialize a newly created task descriptor to have the given [name] and to |
| * describe a task that takes the inputs built using the given [createTaskInputs], |
| * and produces the given [results]. The [buildTask] will be used to create |
| * the instance of [AnalysisTask] thusly described. |
| */ |
| TaskDescriptorImpl( |
| - this.name, this.buildTask, this.createTaskInputs, this.results); |
| + this.name, this.buildTask, this.createTaskInputs, this.results, |
| + {IsAppropriateFor isAppropriateFor}) |
|
Paul Berry
2016/01/25 20:12:40
Suggestion: make the default value of isAppropriat
Brian Wilkerson
2016/01/25 20:27:36
Good suggestion, but I modified it somewhat. Inste
|
| + : _isAppropriateFor = isAppropriateFor; |
| @override |
| AnalysisTask createTask(AnalysisContext context, AnalysisTarget target, |
| @@ -143,5 +151,13 @@ class TaskDescriptorImpl implements TaskDescriptor { |
| } |
| @override |
| + bool isAppropriateFor(AnalysisTarget target) { |
| + if (_isAppropriateFor == null) { |
| + return true; |
| + } |
| + return _isAppropriateFor(target); |
| + } |
| + |
| + @override |
| String toString() => name; |
| } |