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

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

Issue 1633823002: Add support for tasks to determine whether they are appropriate for a given target (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 | « no previous file | pkg/analyzer/lib/task/model.dart » ('j') | pkg/analyzer/lib/task/model.dart » ('J')
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 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;
}
« no previous file with comments | « no previous file | pkg/analyzer/lib/task/model.dart » ('j') | pkg/analyzer/lib/task/model.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698