Skip to content

Commit

Permalink
Add links to Scope Functions docs (PR #2407)
Browse files Browse the repository at this point in the history
Add links to Scope Functions docs on kotlinlang.org to 'with', 'run', 'let', 'apply', and 'also' extension function docs
  • Loading branch information
kevpeek authored and ilya-g committed Jun 13, 2019
1 parent 1f17ff5 commit 4c91ba9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions libraries/stdlib/src/kotlin/util/Standard.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public inline fun TODO(reason: String): Nothing = throw NotImplementedError("An

/**
* Calls the specified function [block] and returns its result.
*
* For detailed usage information see the documentation for [scope functions](https://kotlinlang.org/docs/reference/scope-functions.html#run).
*/
@kotlin.internal.InlineOnly
public inline fun <R> run(block: () -> R): R {
Expand All @@ -44,6 +46,8 @@ public inline fun <R> run(block: () -> R): R {

/**
* Calls the specified function [block] with `this` value as its receiver and returns its result.
*
* For detailed usage information see the documentation for [scope functions](https://kotlinlang.org/docs/reference/scope-functions.html#run).
*/
@kotlin.internal.InlineOnly
public inline fun <T, R> T.run(block: T.() -> R): R {
Expand All @@ -55,6 +59,8 @@ public inline fun <T, R> T.run(block: T.() -> R): R {

/**
* Calls the specified function [block] with the given [receiver] as its receiver and returns its result.
*
* For detailed usage information see the documentation for [scope functions](https://kotlinlang.org/docs/reference/scope-functions.html#with).
*/
@kotlin.internal.InlineOnly
public inline fun <T, R> with(receiver: T, block: T.() -> R): R {
Expand All @@ -66,6 +72,8 @@ public inline fun <T, R> with(receiver: T, block: T.() -> R): R {

/**
* Calls the specified function [block] with `this` value as its receiver and returns `this` value.
*
* For detailed usage information see the documentation for [scope functions](https://kotlinlang.org/docs/reference/scope-functions.html#apply).
*/
@kotlin.internal.InlineOnly
public inline fun <T> T.apply(block: T.() -> Unit): T {
Expand All @@ -78,6 +86,8 @@ public inline fun <T> T.apply(block: T.() -> Unit): T {

/**
* Calls the specified function [block] with `this` value as its argument and returns `this` value.
*
* For detailed usage information see the documentation for [scope functions](https://kotlinlang.org/docs/reference/scope-functions.html#also).
*/
@kotlin.internal.InlineOnly
@SinceKotlin("1.1")
Expand All @@ -91,6 +101,8 @@ public inline fun <T> T.also(block: (T) -> Unit): T {

/**
* Calls the specified function [block] with `this` value as its argument and returns its result.
*
* For detailed usage information see the documentation for [scope functions](https://kotlinlang.org/docs/reference/scope-functions.html#let).
*/
@kotlin.internal.InlineOnly
public inline fun <T, R> T.let(block: (T) -> R): R {
Expand Down

0 comments on commit 4c91ba9

Please sign in to comment.