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

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

Issue 2990843002: Removed fixed dependencies (Closed)
Patch Set: Created 3 years, 5 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 | « packages/analyzer/lib/src/task/manager.dart ('k') | packages/analyzer/lib/src/task/options.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/analyzer/lib/src/task/model.dart
diff --git a/packages/analyzer/lib/src/task/model.dart b/packages/analyzer/lib/src/task/model.dart
index 50c05eed6ce1528fbda9f8552c282942cb51c426..47de4b3143399d07dd27a609fcfcd161d4d3b6a6 100644
--- a/packages/analyzer/lib/src/task/model.dart
+++ b/packages/analyzer/lib/src/task/model.dart
@@ -4,14 +4,14 @@
library analyzer.src.task.model;
-import 'package:analyzer/src/generated/engine.dart' hide AnalysisTask;
+import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/task/inputs.dart';
import 'package:analyzer/task/model.dart';
/**
* The default [ResultCachingPolicy], results are never flushed.
*/
-const ResultCachingPolicy DEFAULT_CACHING_POLICY =
+const ResultCachingPolicy<Object> DEFAULT_CACHING_POLICY =
const SimpleResultCachingPolicy(-1, -1);
/**
@@ -125,14 +125,24 @@ class TaskDescriptorImpl implements TaskDescriptor {
@override
final List<ResultDescriptor> results;
+ /**
+ * The function used to determine whether the described task is suitable for
+ * a given target.
+ */
+ final SuitabilityFor _suitabilityFor;
+
/**
* 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.
+ * describe a task that takes the inputs built using the given [inputBuilder],
+ * and produces the given [results]. The [buildTask] function will be used to
+ * create the instance of [AnalysisTask] being described. If provided, the
+ * [isAppropriateFor] function will be used to determine whether the task can
+ * be used on a specific target.
*/
TaskDescriptorImpl(
- this.name, this.buildTask, this.createTaskInputs, this.results);
+ this.name, this.buildTask, this.createTaskInputs, this.results,
+ {SuitabilityFor suitabilityFor})
+ : _suitabilityFor = suitabilityFor ?? _defaultSuitability;
@override
AnalysisTask createTask(AnalysisContext context, AnalysisTarget target,
@@ -142,6 +152,17 @@ class TaskDescriptorImpl implements TaskDescriptor {
return task;
}
+ @override
+ TaskSuitability suitabilityFor(AnalysisTarget target) =>
+ _suitabilityFor(target);
+
@override
String toString() => name;
+
+ /**
+ * The function that will be used to determine the suitability of a task if no
+ * other function is provided.
+ */
+ static TaskSuitability _defaultSuitability(AnalysisTarget target) =>
+ TaskSuitability.LOWEST;
}
« no previous file with comments | « packages/analyzer/lib/src/task/manager.dart ('k') | packages/analyzer/lib/src/task/options.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698