Delegated properties.

This commit is contained in:
Dmitry Petrov
2016-09-01 12:52:49 +03:00
committed by Dmitry Petrov
parent 865d2c43c7
commit 759f0168c2
19 changed files with 415 additions and 58 deletions
@@ -0,0 +1,8 @@
val test1 by lazy { 42 }
class C(val map: MutableMap<String, Any>) {
val test2 by lazy { 42 }
var test3 by map
}
var test4 by hashMapOf<String, Any>()
@@ -0,0 +1,82 @@
FILE /delegatedProperties.kt
PROPERTY public val test1: kotlin.Int
DELEGATE val `test1$delegate`: kotlin.Lazy<kotlin.Int>
EXPRESSION_BODY
CALL .lazy type=kotlin.Lazy<kotlin.Int> operator=null
initializer: BLOCK type=() -> kotlin.Int operator=LAMBDA
FUN local final fun <anonymous>(): kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from=<anonymous>
CONST Int type=kotlin.Int value='42'
CALLABLE_REFERENCE local final fun <anonymous>(): kotlin.Int type=() -> kotlin.Int
PROPERTY_GETTER public fun <get-test1>(): kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from=<get-test1>
CALL .getValue type=kotlin.Int operator=null
$receiver: GET_VAR test1$delegate type=kotlin.Lazy<kotlin.Int> operator=null
thisRef: CONST Null type=kotlin.Nothing? value='null'
property: CALLABLE_REFERENCE public val test1: kotlin.Int type=kotlin.reflect.KProperty0<kotlin.Int>
CLASS CLASS C
CONSTRUCTOR public constructor C(/*0*/ map: kotlin.collections.MutableMap<kotlin.String, kotlin.Any>)
BLOCK_BODY
SET_BACKING_FIELD map type=kotlin.Unit operator=null
GET_VAR map type=kotlin.collections.MutableMap<kotlin.String, kotlin.Any> operator=INITIALIZE_PROPERTY_FROM_PARAMETER
PROPERTY public final val map: kotlin.collections.MutableMap<kotlin.String, kotlin.Any>
EXPRESSION_BODY
GET_VAR map type=kotlin.collections.MutableMap<kotlin.String, kotlin.Any> operator=INITIALIZE_PROPERTY_FROM_PARAMETER
PROPERTY public final val test2: kotlin.Int
DELEGATE val `test2$delegate`: kotlin.Lazy<kotlin.Int>
EXPRESSION_BODY
CALL .lazy type=kotlin.Lazy<kotlin.Int> operator=null
initializer: BLOCK type=() -> kotlin.Int operator=LAMBDA
FUN local final fun <anonymous>(): kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from=<anonymous>
CONST Int type=kotlin.Int value='42'
CALLABLE_REFERENCE local final fun <anonymous>(): kotlin.Int type=() -> kotlin.Int
PROPERTY_GETTER public final fun <get-test2>(): kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from=<get-test2>
CALL .getValue type=kotlin.Int operator=null
$receiver: GET_VAR test2$delegate type=kotlin.Lazy<kotlin.Int> operator=null
thisRef: THIS public final class C type=C
property: CALLABLE_REFERENCE public final val test2: kotlin.Int type=kotlin.reflect.KProperty1<C, kotlin.Int>
PROPERTY public final var test3: kotlin.Any
DELEGATE val `test3$delegate`: kotlin.collections.MutableMap<kotlin.String, kotlin.Any>
EXPRESSION_BODY
CALL .<get-map> type=kotlin.collections.MutableMap<kotlin.String, kotlin.Any> operator=GET_PROPERTY
$this: THIS public final class C type=C
PROPERTY_GETTER public final fun <get-test3>(): kotlin.Any
BLOCK_BODY
RETURN type=kotlin.Nothing from=<get-test3>
CALL .getValue type=kotlin.Any operator=null
$receiver: GET_VAR test3$delegate type=kotlin.collections.MutableMap<kotlin.String, kotlin.Any> operator=null
thisRef: THIS public final class C type=C
property: CALLABLE_REFERENCE public final var test3: kotlin.Any type=kotlin.reflect.KMutableProperty1<C, kotlin.Any>
PROPERTY_SETTER public final fun <set-test3>(/*0*/ <set-?>: kotlin.Any): kotlin.Unit
BLOCK_BODY
RETURN type=kotlin.Nothing from=<set-test3>
CALL .setValue type=kotlin.Unit operator=null
$receiver: GET_VAR test3$delegate type=kotlin.collections.MutableMap<kotlin.String, kotlin.Any> operator=null
thisRef: THIS public final class C type=C
property: CALLABLE_REFERENCE public final var test3: kotlin.Any type=kotlin.reflect.KMutableProperty1<C, kotlin.Any>
value: GET_VAR <set-?> type=kotlin.Any operator=null
PROPERTY public var test4: kotlin.Any
DELEGATE val `test4$delegate`: java.util.HashMap<kotlin.String, kotlin.Any>
EXPRESSION_BODY
CALL .hashMapOf type=java.util.HashMap<kotlin.String, kotlin.Any> operator=null
PROPERTY_GETTER public fun <get-test4>(): kotlin.Any
BLOCK_BODY
RETURN type=kotlin.Nothing from=<get-test4>
CALL .getValue type=kotlin.Any operator=null
$receiver: GET_VAR test4$delegate type=java.util.HashMap<kotlin.String, kotlin.Any> operator=null
thisRef: CONST Null type=kotlin.Nothing? value='null'
property: CALLABLE_REFERENCE public var test4: kotlin.Any type=kotlin.reflect.KMutableProperty0<kotlin.Any>
PROPERTY_SETTER public fun <set-test4>(/*0*/ <set-?>: kotlin.Any): kotlin.Unit
BLOCK_BODY
RETURN type=kotlin.Nothing from=<set-test4>
CALL .setValue type=kotlin.Unit operator=null
$receiver: GET_VAR test4$delegate type=java.util.HashMap<kotlin.String, kotlin.Any> operator=null
thisRef: CONST Null type=kotlin.Nothing? value='null'
property: CALLABLE_REFERENCE public var test4: kotlin.Any type=kotlin.reflect.KMutableProperty0<kotlin.Any>
value: GET_VAR <set-?> type=kotlin.Any operator=null