Reflection literals (no bound member references yet).

This commit is contained in:
Dmitry Petrov
2016-09-02 15:49:48 +03:00
committed by Dmitry Petrov
parent 8b95992af1
commit 3c0cce4c48
9 changed files with 187 additions and 3 deletions
@@ -0,0 +1,13 @@
class A {
fun foo() {}
}
fun bar() {}
val qux = 42
val test1 = A::class
val test2 = qux::class
val test3 = A::foo
val test4 = ::A
val test5 = A()::foo
val test6 = ::bar
val test7 = ::qux
@@ -0,0 +1,34 @@
FILE /reflectionLiterals.kt
CLASS CLASS A
CONSTRUCTOR public constructor A()
BLOCK_BODY
INSTANCE_INITIALIZER_CALL classDescriptor=A
FUN public final fun foo(): kotlin.Unit
BLOCK_BODY
FUN public fun bar(): kotlin.Unit
BLOCK_BODY
PROPERTY public val qux: kotlin.Int = 42
EXPRESSION_BODY
CONST Int type=kotlin.Int value='42'
PROPERTY public val test1: kotlin.reflect.KClass<A>
EXPRESSION_BODY
CLASS_REFERENCE public final class A type=kotlin.reflect.KClass<A>
PROPERTY public val test2: kotlin.reflect.KClass<kotlin.Int>
EXPRESSION_BODY
GET_CLASS type=kotlin.reflect.KClass<kotlin.Int>
CALL .<get-qux> type=kotlin.Int operator=GET_PROPERTY
PROPERTY public val test3: kotlin.reflect.KFunction1<A, kotlin.Unit>
EXPRESSION_BODY
CALLABLE_REFERENCE public final fun foo(): kotlin.Unit type=kotlin.reflect.KFunction1<A, kotlin.Unit>
PROPERTY public val test4: kotlin.reflect.KFunction0<A>
EXPRESSION_BODY
CALLABLE_REFERENCE public constructor A() type=kotlin.reflect.KFunction0<A>
PROPERTY public val test5: kotlin.reflect.KFunction0<kotlin.Unit>
EXPRESSION_BODY
CALLABLE_REFERENCE public final fun foo(): kotlin.Unit type=kotlin.reflect.KFunction0<kotlin.Unit>
PROPERTY public val test6: kotlin.reflect.KFunction0<kotlin.Unit>
EXPRESSION_BODY
CALLABLE_REFERENCE public fun bar(): kotlin.Unit type=kotlin.reflect.KFunction0<kotlin.Unit>
PROPERTY public val test7: kotlin.reflect.KProperty0<kotlin.Int>
EXPRESSION_BODY
CALLABLE_REFERENCE public val qux: kotlin.Int = 42 type=kotlin.reflect.KProperty0<kotlin.Int>