Chromium Code Reviews| 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 72532e738939890a8fc5da4eb2b00399c2edaed5..221861bfd14e905009075dd18298442b6258b012 100644 |
| --- a/pkg/analyzer/lib/src/task/inputs.dart |
| +++ b/pkg/analyzer/lib/src/task/inputs.dart |
| @@ -20,35 +20,13 @@ typedef TaskInput<E> GenerateTaskInputs<B, E>(B object); |
| * defined on a single target. |
| */ |
| class ListTaskInputImpl<E> extends SimpleTaskInput<List<E>> |
| - implements ListTaskInput<E> { |
| + with _ListTaskInputMixin<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 /*<V>*/ > toList(UnaryFunction<E, dynamic /*<V>*/ > mapper) { |
| - return new ListToListTaskInput<E, dynamic /*V*/ >(this, mapper); |
| - } |
| - |
| - @override |
| - TaskInput<List /*<V>*/ > toListOf(ResultDescriptor /*<V>*/ valueResult) { |
| - return (this as ListTaskInputImpl<AnalysisTarget>).toList(valueResult.of); |
| - } |
| - |
| - @override |
| - TaskInput<Map<E, dynamic /*V*/ >> toMap( |
| - UnaryFunction<E, dynamic /*<V>*/ > mapper) { |
| - return new ListToMapTaskInput<E, dynamic /*V*/ >(this, mapper); |
| - } |
| - |
| - @override |
| - TaskInput<Map<AnalysisTarget, dynamic /*V*/ >> toMapOf( |
| - ResultDescriptor /*<V>*/ valueResult) { |
| - return (this as ListTaskInputImpl<AnalysisTarget>).toMap(valueResult.of); |
| - } |
| } |
| /** |
| @@ -59,7 +37,8 @@ class ListTaskInputImpl<E> extends SimpleTaskInput<List<E>> |
| * and the list of the analysis results is used as the input to the task. |
| */ |
| class ListToListTaskInput<B, E> |
| - extends _ListToCollectionTaskInput<B, E, List<E>> { |
| + extends _ListToCollectionTaskInput<B, E, List<E>> |
| + with _ListTaskInputMixin<E> { |
| /** |
| * Initialize a result accessor to use the given [baseAccessor] to access a |
| * list of values that can be passed to the given [generateTaskInputs] to |
| @@ -380,6 +359,29 @@ class TopLevelTaskInputBuilder |
| } |
| /** |
| + * A mixin-ready class implementing [ListTaskInput]. |
| + */ |
| +abstract class _ListTaskInputMixin<E> implements ListTaskInput<E> { |
|
Brian Wilkerson
2015/03/25 21:20:58
Is there any reason to make this a private class (
|
| + ListTaskInput /*<V>*/ toList(UnaryFunction<E, dynamic /*<V>*/ > mapper) { |
| + return new ListToListTaskInput<E, dynamic /*V*/ >(this, mapper); |
| + } |
| + |
| + ListTaskInput /*<V>*/ toListOf(ResultDescriptor /*<V>*/ valueResult) { |
| + return (this as ListTaskInputImpl<AnalysisTarget>).toList(valueResult.of); |
| + } |
| + |
| + TaskInput<Map<E, dynamic /*V*/ >> toMap( |
| + UnaryFunction<E, dynamic /*<V>*/ > mapper) { |
| + return new ListToMapTaskInput<E, dynamic /*V*/ >(this, mapper); |
| + } |
| + |
| + TaskInput<Map<AnalysisTarget, dynamic /*V*/ >> toMapOf( |
| + ResultDescriptor /*<V>*/ valueResult) { |
| + return (this as ListTaskInputImpl<AnalysisTarget>).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 |