Use delegate initializer expression resolution scope for 'toDelegateFor' resolution.
This commit is contained in:
committed by
Stanislav Erokhin
parent
a6bc7271ae
commit
5ddf8e60e6
+16
@@ -0,0 +1,16 @@
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
var log = ""
|
||||
|
||||
class UserDataProperty<in R>(val key: String) {
|
||||
operator fun getValue(thisRef: R, desc: KProperty<*>) = thisRef.toString() + key
|
||||
|
||||
operator fun setValue(thisRef: R, desc: KProperty<*>, value: String?) { log += "set"}
|
||||
}
|
||||
|
||||
|
||||
var String.calc: String by UserDataProperty("K")
|
||||
|
||||
fun box(): String {
|
||||
return "O".calc
|
||||
}
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
public final class ExtensionDelegatedKt {
|
||||
private synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
|
||||
private final static @org.jetbrains.annotations.NotNull field calc$delegate: UserDataProperty
|
||||
private static @org.jetbrains.annotations.NotNull field log: java.lang.String
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
public final static @org.jetbrains.annotations.NotNull method getCalc(@org.jetbrains.annotations.NotNull p0: java.lang.String): java.lang.String
|
||||
public final static @org.jetbrains.annotations.NotNull method getLog(): java.lang.String
|
||||
public final static method setCalc(@org.jetbrains.annotations.NotNull p0: java.lang.String, @org.jetbrains.annotations.NotNull p1: java.lang.String): void
|
||||
public final static method setLog(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
|
||||
}
|
||||
|
||||
|
||||
public final class UserDataProperty {
|
||||
private final @org.jetbrains.annotations.NotNull field key: java.lang.String
|
||||
public method <init>(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
|
||||
public final @org.jetbrains.annotations.NotNull method getKey(): java.lang.String
|
||||
public final @org.jetbrains.annotations.NotNull method getValue(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.reflect.KProperty): java.lang.String
|
||||
public final method setValue(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.reflect.KProperty, @org.jetbrains.annotations.Nullable p2: java.lang.String): void
|
||||
}
|
||||
Reference in New Issue
Block a user