Introduce apply() scope function.

#KT-6903 Fixed
This commit is contained in:
Ilya Gorbunov
2015-06-01 23:53:50 +03:00
parent 3e231f2e44
commit 8a578a46f6
@@ -23,6 +23,8 @@ public inline fun <T, R> T.run(f: T.() -> R): R = f()
*/
public inline fun <T, R> with(receiver: T, f: T.() -> R): R = receiver.f()
public inline fun <T> T.apply(f: T.() -> Unit): T { f(); return this }
/**
* Converts receiver to body parameter
*/