Skip to content

Commit

Permalink
Introduce apply() scope function.
Browse files Browse the repository at this point in the history
#KT-6903 Fixed
  • Loading branch information
ilya-g committed Jul 19, 2015
1 parent 3e231f2 commit 8a578a4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libraries/stdlib/src/kotlin/util/Standard.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down

0 comments on commit 8a578a4

Please sign in to comment.