Lambda expressions (no closures yet).
This commit is contained in:
committed by
Dmitry Petrov
parent
0b647ac358
commit
83c3bdd788
@@ -2,7 +2,12 @@ FILE /variableAsFunctionCall.kt
|
||||
FUN public fun kotlin.String.k(): () -> kotlin.String
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
DUMMY KtLambdaExpression type=() -> kotlin.String
|
||||
BLOCK type=() -> kotlin.String operator=LAMBDA
|
||||
FUN local final fun <anonymous>(): kotlin.String
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
$RECEIVER of: k type=kotlin.String
|
||||
CALLABLE_REFERENCE local final fun <anonymous>(): kotlin.String type=() -> kotlin.String
|
||||
FUN public fun test1(/*0*/ f: () -> kotlin.Unit): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
fun test1() = "42".run { length }
|
||||
@@ -0,0 +1,13 @@
|
||||
FILE /extensionLambda.kt
|
||||
FUN public fun test1(): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .run type=kotlin.Int operator=null
|
||||
$receiver: CONST String type=kotlin.String value='42'
|
||||
block: BLOCK type=kotlin.String.() -> kotlin.Int operator=LAMBDA
|
||||
FUN local final fun kotlin.String.<anonymous>(): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .<get-length> type=kotlin.Int operator=GET_PROPERTY
|
||||
$this: $RECEIVER of: <anonymous> type=kotlin.String
|
||||
CALLABLE_REFERENCE local final fun kotlin.String.<anonymous>(): kotlin.Int type=kotlin.String.() -> kotlin.Int
|
||||
@@ -0,0 +1 @@
|
||||
val lambda = { 42 }
|
||||
@@ -0,0 +1,9 @@
|
||||
FILE /justLambda.kt
|
||||
PROPERTY public val lambda: () -> kotlin.Int getter=null setter=null
|
||||
EXPRESSION_BODY
|
||||
BLOCK type=() -> kotlin.Int operator=LAMBDA
|
||||
FUN local final fun <anonymous>(): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CONST Int type=kotlin.Int value='42'
|
||||
CALLABLE_REFERENCE local final fun <anonymous>(): kotlin.Int type=() -> kotlin.Int
|
||||
@@ -0,0 +1,20 @@
|
||||
object A
|
||||
object B
|
||||
|
||||
interface IFoo {
|
||||
val A.foo: B get() = B
|
||||
}
|
||||
|
||||
interface IInvoke {
|
||||
operator fun B.invoke() = 42
|
||||
}
|
||||
|
||||
fun test(fooImpl: IFoo, invokeImpl: IInvoke) {
|
||||
with(A) {
|
||||
with(fooImpl) {
|
||||
with(invokeImpl) {
|
||||
foo()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
FILE /multipleImplicitReceivers.kt
|
||||
CLASS OBJECT A
|
||||
CLASS OBJECT B
|
||||
CLASS INTERFACE IFoo
|
||||
PROPERTY public open val A.foo: B getter=<get-foo> setter=null
|
||||
PROPERTY_GETTER public open fun A.<get-foo>(): B property=foo
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
GET_OBJECT B type=B
|
||||
CLASS INTERFACE IInvoke
|
||||
FUN public open operator fun B.invoke(): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CONST Int type=kotlin.Int value='42'
|
||||
FUN public fun test(/*0*/ fooImpl: IFoo, /*1*/ invokeImpl: IInvoke): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
CALL .with type=kotlin.Int operator=null
|
||||
receiver: GET_OBJECT A type=A
|
||||
block: BLOCK type=A.() -> kotlin.Int operator=LAMBDA
|
||||
FUN local final fun A.<anonymous>(): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .with type=kotlin.Int operator=null
|
||||
receiver: GET_VAR fooImpl type=IFoo operator=null
|
||||
block: BLOCK type=IFoo.() -> kotlin.Int operator=LAMBDA
|
||||
FUN local final fun IFoo.<anonymous>(): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .with type=kotlin.Int operator=null
|
||||
receiver: GET_VAR invokeImpl type=IInvoke operator=null
|
||||
block: BLOCK type=IInvoke.() -> kotlin.Int operator=LAMBDA
|
||||
FUN local final fun IInvoke.<anonymous>(): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .invoke type=kotlin.Int operator=INVOKE
|
||||
$this: $RECEIVER of: <anonymous> type=IInvoke
|
||||
$receiver: CALL .<get-foo> type=B operator=GET_PROPERTY
|
||||
$this: $RECEIVER of: <anonymous> type=IFoo
|
||||
$receiver: $RECEIVER of: <anonymous> type=A
|
||||
CALLABLE_REFERENCE local final fun IInvoke.<anonymous>(): kotlin.Int type=IInvoke.() -> kotlin.Int
|
||||
CALLABLE_REFERENCE local final fun IFoo.<anonymous>(): kotlin.Int type=IFoo.() -> kotlin.Int
|
||||
CALLABLE_REFERENCE local final fun A.<anonymous>(): kotlin.Int type=A.() -> kotlin.Int
|
||||
Reference in New Issue
Block a user