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

Unified Diff: packages/analyzer/lib/src/task/manager.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/inputs.dart ('k') | packages/analyzer/lib/src/task/model.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/analyzer/lib/src/task/manager.dart
diff --git a/packages/analyzer/lib/src/task/manager.dart b/packages/analyzer/lib/src/task/manager.dart
index eebc08491fdea0fa1ef13f0b43babc5de5cf7d7a..059257ff260d469d1aae12ed4030fc431f884348 100644
--- a/packages/analyzer/lib/src/task/manager.dart
+++ b/packages/analyzer/lib/src/task/manager.dart
@@ -6,7 +6,7 @@ library analyzer.src.task.manager;
import 'dart:collection';
-import 'package:analyzer/src/generated/java_engine.dart';
+import 'package:analyzer/exception/exception.dart';
import 'package:analyzer/task/model.dart';
/**
@@ -83,7 +83,7 @@ class TaskManager {
throw new AnalysisException(
'No tasks registered to compute $result for $target');
}
- return _findBestTask(descriptors);
+ return _findBestTask(descriptors, target);
}
/**
@@ -104,11 +104,20 @@ class TaskManager {
/**
* Given a list of task [descriptors] that can be used to compute some
- * unspecified result, return the descriptor that will compute the result with
- * the least amount of work.
+ * unspecified result for the given [target], return the descriptor that
+ * should be used to compute the result.
*/
- TaskDescriptor _findBestTask(List<TaskDescriptor> descriptors) {
- // TODO(brianwilkerson) Improve this implementation.
- return descriptors[0];
+ TaskDescriptor _findBestTask(
+ List<TaskDescriptor> descriptors, AnalysisTarget target) {
+ TaskDescriptor best = null;
+ for (TaskDescriptor descriptor in descriptors) {
+ TaskSuitability suitability = descriptor.suitabilityFor(target);
+ if (suitability == TaskSuitability.HIGHEST) {
+ return descriptor;
+ } else if (best == null && suitability == TaskSuitability.LOWEST) {
+ best = descriptor;
+ }
+ }
+ return best;
}
}
« no previous file with comments | « packages/analyzer/lib/src/task/inputs.dart ('k') | packages/analyzer/lib/src/task/model.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698