OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library analyzer.src.task.inputs; | 5 library analyzer.src.task.inputs; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 | 8 |
9 import 'package:analyzer/task/model.dart'; | 9 import 'package:analyzer/task/model.dart'; |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 @override | 32 @override |
33 TaskInputBuilder<V> createBuilder() { | 33 TaskInputBuilder<V> createBuilder() { |
34 return new ConstantTaskInputBuilder<V>(this); | 34 return new ConstantTaskInputBuilder<V>(this); |
35 } | 35 } |
36 } | 36 } |
37 | 37 |
38 /** | 38 /** |
39 * A [TaskInputBuilder] used to build an input based on a [ConstantTaskInput]. | 39 * A [TaskInputBuilder] used to build an input based on a [ConstantTaskInput]. |
40 */ | 40 */ |
41 class ConstantTaskInputBuilder<V> implements TaskInputBuilder<V> { | 41 class ConstantTaskInputBuilder<V> implements TaskInputBuilder<V> { |
42 final ConstantTaskInput input; | 42 final ConstantTaskInput<V> input; |
43 | 43 |
44 ConstantTaskInputBuilder(this.input); | 44 ConstantTaskInputBuilder(this.input); |
45 | 45 |
46 @override | 46 @override |
47 ResultDescriptor get currentResult => null; | 47 ResultDescriptor get currentResult => null; |
48 | 48 |
49 @override | 49 @override |
50 AnalysisTarget get currentTarget => null; | 50 AnalysisTarget get currentTarget => null; |
51 | 51 |
52 @override | 52 @override |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 | 152 |
153 /** | 153 /** |
154 * Initialize a newly created task input builder that computes the result | 154 * Initialize a newly created task input builder that computes the result |
155 * specified by the given [input]. | 155 * specified by the given [input]. |
156 */ | 156 */ |
157 ListToFlattenListTaskInputBuilder(ListToFlattenListTaskInput<B, E> input) | 157 ListToFlattenListTaskInputBuilder(ListToFlattenListTaskInput<B, E> input) |
158 : super(input); | 158 : super(input); |
159 | 159 |
160 @override | 160 @override |
161 void _addResultElement(B baseElement, E resultElement) { | 161 void _addResultElement(B baseElement, E resultElement) { |
162 _resultValue.addAll(resultElement as Iterable); | 162 _resultValue.addAll(resultElement as Iterable<E>); |
163 } | 163 } |
164 | 164 |
165 @override | 165 @override |
166 void _initResultValue() { | 166 void _initResultValue() { |
167 _resultValue = <E>[]; | 167 _resultValue = <E>[]; |
168 } | 168 } |
169 } | 169 } |
170 | 170 |
171 /** | 171 /** |
172 * An input to an [AnalysisTask] that is computed by the following steps. First | 172 * An input to an [AnalysisTask] that is computed by the following steps. First |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 } | 411 } |
412 } | 412 } |
413 | 413 |
414 /** | 414 /** |
415 * An input to an [AnalysisTask] that is computed by mapping the value of | 415 * An input to an [AnalysisTask] that is computed by mapping the value of |
416 * another task input to a list of values. | 416 * another task input to a list of values. |
417 */ | 417 */ |
418 class ObjectToListTaskInput<E> extends TaskInputImpl<List<E>> | 418 class ObjectToListTaskInput<E> extends TaskInputImpl<List<E>> |
419 with ListTaskInputMixin<E> | 419 with ListTaskInputMixin<E> |
420 implements ListTaskInput<E> { | 420 implements ListTaskInput<E> { |
| 421 // TODO(brianwilkerson) Add another type parameter to this class that can be |
| 422 // used as the type of the keys of [mapper]. |
421 /** | 423 /** |
422 * The input used to compute the value to be mapped. | 424 * The input used to compute the value to be mapped. |
423 */ | 425 */ |
424 final TaskInput baseInput; | 426 final TaskInput baseInput; |
425 | 427 |
426 /** | 428 /** |
427 * The function used to map the value of the base input to the list of values. | 429 * The function used to map the value of the base input to the list of values. |
428 */ | 430 */ |
429 final Mapper<Object, List<E>> mapper; | 431 final Mapper<Object, List<E>> mapper; |
430 | 432 |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
985 return false; | 987 return false; |
986 } | 988 } |
987 _baseListElement = _baseList[_baseListIndex]; | 989 _baseListElement = _baseList[_baseListIndex]; |
988 currentBuilder = input.generateTaskInputs(_baseListElement).createBuilder(); | 990 currentBuilder = input.generateTaskInputs(_baseListElement).createBuilder(); |
989 return currentBuilder.moveNext(); | 991 return currentBuilder.moveNext(); |
990 } | 992 } |
991 | 993 |
992 void _addResultElement(B baseElement, E resultElement); | 994 void _addResultElement(B baseElement, E resultElement); |
993 void _initResultValue(); | 995 void _initResultValue(); |
994 } | 996 } |
OLD | NEW |