Permalink
Browse files

Introduce apply() scope function.

#KT-6903 Fixed
  • Loading branch information...
ilya-g committed Jun 1, 2015
1 parent 3e231f2 commit 8a578a46f686b691320da2f7524f752fa573ee67
Showing with 2 additions and 0 deletions.
  1. +2 −0 libraries/stdlib/src/kotlin/util/Standard.kt
@@ -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
*/

0 comments on commit 8a578a4

Please sign in to comment.