Add 'operator' modifier to stdlib property Delegate functions
This commit is contained in:
@@ -17,7 +17,7 @@ public interface ReadOnlyProperty<in R, out T> {
|
||||
* @param property the metadata for the property.
|
||||
* @return the property value.
|
||||
*/
|
||||
public fun getValue(thisRef: R, property: PropertyMetadata): T
|
||||
public operator fun getValue(thisRef: R, property: PropertyMetadata): T
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -36,7 +36,7 @@ public interface ReadWriteProperty<in R, T> {
|
||||
* @param property the metadata for the property.
|
||||
* @return the property value.
|
||||
*/
|
||||
public fun getValue(thisRef: R, property: PropertyMetadata): T
|
||||
public operator fun getValue(thisRef: R, property: PropertyMetadata): T
|
||||
|
||||
/**
|
||||
* Sets the value of the property for the given object.
|
||||
@@ -44,5 +44,5 @@ public interface ReadWriteProperty<in R, T> {
|
||||
* @param property the metadata for the property.
|
||||
* @param value the value to set.
|
||||
*/
|
||||
public fun setValue(thisRef: R, property: PropertyMetadata, value: T)
|
||||
public operator fun setValue(thisRef: R, property: PropertyMetadata, value: T)
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ package kotlin.properties
|
||||
*
|
||||
* @throws NoSuchElementException when the map doesn't contain value for the property name and doesn't provide an implicit default (see [withDefault]).
|
||||
*/
|
||||
public fun <V, V1: V> Map<in String, @Exact V>.getValue(thisRef: Any?, property: PropertyMetadata): V1 = getOrImplicitDefault(property.name) as V1
|
||||
public operator fun <V, V1: V> Map<in String, @Exact V>.getValue(thisRef: Any?, property: PropertyMetadata): V1 = getOrImplicitDefault(property.name) as V1
|
||||
|
||||
/**
|
||||
* Returns the value of the property for the given object from this mutable map.
|
||||
@@ -22,7 +22,7 @@ public fun <V, V1: V> Map<in String, @Exact V>.getValue(thisRef: Any?, property:
|
||||
* @throws NoSuchElementException when the map doesn't contain value for the property name and doesn't provide an implicit default (see [withDefault]).
|
||||
*/
|
||||
@kotlin.jvm.JvmName("getVar")
|
||||
public fun <V> MutableMap<in String, in V>.getValue(thisRef: Any?, property: PropertyMetadata): V = getOrImplicitDefault(property.name) as V
|
||||
public operator fun <V> MutableMap<in String, in V>.getValue(thisRef: Any?, property: PropertyMetadata): V = getOrImplicitDefault(property.name) as V
|
||||
|
||||
/**
|
||||
* Stores the value of the property for the given object in this mutable map.
|
||||
@@ -30,6 +30,6 @@ public fun <V> MutableMap<in String, in V>.getValue(thisRef: Any?, property: Pro
|
||||
* @param property the metadata for the property, used to get the name of property and store the value associated with that name in the map.
|
||||
* @param value the value to set.
|
||||
*/
|
||||
public fun <V> MutableMap<in String, in V>.setValue(thisRef: Any?, property: PropertyMetadata, value: V) {
|
||||
public operator fun <V> MutableMap<in String, in V>.setValue(thisRef: Any?, property: PropertyMetadata, value: V) {
|
||||
this.put(property.name, value)
|
||||
}
|
||||
@@ -74,7 +74,7 @@ public fun lazy<T>(lock: Any?, initializer: () -> T): Lazy<T> = SynchronizedLazy
|
||||
* This extension allows to use instances of Lazy for property delegation:
|
||||
* `val property: String by lazy { initializer }`
|
||||
*/
|
||||
public fun <T> Lazy<T>.getValue(thisRef: Any?, property: PropertyMetadata): T = value
|
||||
public operator fun <T> Lazy<T>.getValue(thisRef: Any?, property: PropertyMetadata): T = value
|
||||
|
||||
/**
|
||||
* Specifies how a [Lazy] instance synchronizes access among multiple threads.
|
||||
|
||||
Reference in New Issue
Block a user