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

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

Issue 1005693007: Add toMap / toMapOf / toList (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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
Index: pkg/analyzer/lib/src/task/inputs.dart
diff --git a/pkg/analyzer/lib/src/task/inputs.dart b/pkg/analyzer/lib/src/task/inputs.dart
index 425869ff462b91d704d8f62b21566db864be0ff8..d06a694ece89c6a60e65c29739ae9d3cc9b97d8f 100644
--- a/pkg/analyzer/lib/src/task/inputs.dart
+++ b/pkg/analyzer/lib/src/task/inputs.dart
@@ -16,6 +16,35 @@ import 'package:analyzer/task/model.dart';
typedef TaskInput<E> GenerateTaskInputs<B, E>(B object);
/**
+ * An input to an [AnalysisTask] that is computed by accessing a single result
+ * defined on a single target.
+ */
+class ListTaskInputImpl<E> extends SimpleTaskInput<List<E>>
+ implements ListTaskInput<E> {
+ /**
+ * Initialize a newly created task input that computes the input by accessing
+ * the given [result] associated with the given [target].
+ */
+ ListTaskInputImpl(AnalysisTarget target, ResultDescriptor<List<E>> result)
+ : super(target, result);
+
+ @override
+ TaskInput<List> toList(MapTaskInput mapper) {
+ return new ListToListTaskInput(this, mapper);
+ }
+
+ @override
+ TaskInput<Map<E, Object>> toMap(GenerateTaskInputs mapper) {
Brian Wilkerson 2015/03/24 15:07:10 The overridden method has a parameter type of MapT
scheglov 2015/03/24 17:16:39 Done.
+ return new ListToMapTaskInput(this, mapper);
+ }
+
+ @override
+ TaskInput<Map> toMapOf(ResultDescriptor valueResult) {
+ return toMap(valueResult.of);
+ }
+}
+
+/**
* An input to an [AnalysisTask] that is computed by the following steps. First
* another (base) task input is used to compute a [List]-valued result. An input
* generator function is then used to map each element of that list to a task

Powered by Google App Engine
This is Rietveld 408576698