Extract Function: Generate named argument for extracted lambda (when necessary)

This commit is contained in:
Alexey Sedunov
2014-09-18 18:28:36 +04:00
parent 6a76ca1066
commit 40761dfc4c
7 changed files with 31 additions and 7 deletions
@@ -0,0 +1,6 @@
fun <T> Array<T>.check(a: Int, b: Int, f: (T) -> Boolean): Boolean = false
// SIBLING:
fun foo(t: Array<Int>) {
t.check(a = 1, b = 2) <selection>{ it + 1 > 1 }</selection>
}
@@ -0,0 +1,10 @@
fun <T> Array<T>.check(a: Int, b: Int, f: (T) -> Boolean): Boolean = false
// SIBLING:
fun foo(t: Array<Int>) {
t.check(a = 1, b = 2, f = function())
}
private fun function(): (Int) -> Boolean {
return { it + 1 > 1 }
}