mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 15:53:19 +00:00
42 lines
563 B
Kotlin
Vendored
42 lines
563 B
Kotlin
Vendored
package foo
|
|
|
|
|
|
class Foo {
|
|
|
|
inline fun inlineFoo(crossinline s: () -> Unit) {
|
|
{
|
|
s()
|
|
}()
|
|
}
|
|
|
|
inline fun simpleFoo(s: () -> Unit) {
|
|
s()
|
|
}
|
|
}
|
|
|
|
|
|
class Bar {
|
|
fun callToInline() {
|
|
Foo().inlineFoo { 1 }
|
|
}
|
|
|
|
fun objectInInlineLambda() {
|
|
val s = 1;
|
|
Foo().simpleFoo {
|
|
{
|
|
s
|
|
}()
|
|
}
|
|
}
|
|
|
|
fun objectInLambdaInlinedIntoObject() {
|
|
val s = 1;
|
|
Foo().inlineFoo {
|
|
{
|
|
s
|
|
}()
|
|
}
|
|
}
|
|
|
|
}
|