One more case when mapTo can be generated
This commit is contained in:
+4
@@ -43,6 +43,10 @@ class AddToCollectionTransformation(
|
||||
FilterToTransformation(loop, inputVariable, targetCollection, previousTransformation.effectiveCondition()) //TODO: use filterNotTo?
|
||||
}
|
||||
|
||||
is MapTransformation -> {
|
||||
MapToTransformation(loop, previousTransformation.inputVariable, targetCollection, previousTransformation.mapping)
|
||||
}
|
||||
|
||||
is FlatMapTransformation -> {
|
||||
FlatMapToTransformation(loop, previousTransformation.inputVariable, targetCollection, previousTransformation.transform)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
fun foo(list: List<String>, target: MutableList<Int>) {
|
||||
<caret>for (s in list) {
|
||||
val l = s.length
|
||||
target.add(l)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// WITH_RUNTIME
|
||||
fun foo(list: List<String>, target: MutableList<Int>) {
|
||||
<caret>list.mapTo(target) { it.length }
|
||||
}
|
||||
Reference in New Issue
Block a user