getValue and setValue are now operators

This commit is contained in:
Nikolay Krasko
2015-10-30 18:55:10 +03:00
parent 5d72629b0b
commit cde6388e26
5 changed files with 9 additions and 7 deletions
@@ -65,7 +65,8 @@ object CreatePropertyDelegateAccessorsActionFactory : CreateCallableMemberFromUs
name = "getValue", name = "getValue",
receiverTypeInfo = accessorReceiverType, receiverTypeInfo = accessorReceiverType,
returnTypeInfo = TypeInfo(propertyType, Variance.OUT_VARIANCE), returnTypeInfo = TypeInfo(propertyType, Variance.OUT_VARIANCE),
parameterInfos = listOf(thisRefParam, metadataParam) parameterInfos = listOf(thisRefParam, metadataParam),
isOperator = true
) )
callableInfos.add(getterInfo) callableInfos.add(getterInfo)
} }
@@ -76,7 +77,8 @@ object CreatePropertyDelegateAccessorsActionFactory : CreateCallableMemberFromUs
name = "setValue", name = "setValue",
receiverTypeInfo = accessorReceiverType, receiverTypeInfo = accessorReceiverType,
returnTypeInfo = TypeInfo(builtIns.unitType, Variance.OUT_VARIANCE), returnTypeInfo = TypeInfo(builtIns.unitType, Variance.OUT_VARIANCE),
parameterInfos = listOf(thisRefParam, metadataParam, newValueParam) parameterInfos = listOf(thisRefParam, metadataParam, newValueParam),
isOperator = true
) )
callableInfos.add(setterInfo) callableInfos.add(setterInfo)
} }
@@ -2,7 +2,7 @@ import kotlin.reflect.KProperty
// "Create member function 'getValue'" "true" // "Create member function 'getValue'" "true"
class F { class F {
fun getValue(x: X, property: KProperty<*>): Int { operator fun getValue(x: X, property: KProperty<*>): Int {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
} }
@@ -2,11 +2,11 @@ import kotlin.reflect.KProperty
// "Create member function 'getValue', function 'setValue'" "true" // "Create member function 'getValue', function 'setValue'" "true"
class F { class F {
fun getValue(x: X, property: KProperty<*>): Int { operator fun getValue(x: X, property: KProperty<*>): Int {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
} }
fun setValue(x: X, property: KProperty<*>, i: Int) { operator fun setValue(x: X, property: KProperty<*>, i: Int) {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
} }
@@ -4,7 +4,7 @@ import kotlin.reflect.KProperty
class F { class F {
fun setValue(x: X, property: KProperty<*>, i: Int) { } fun setValue(x: X, property: KProperty<*>, i: Int) { }
fun getValue(x: X, property: KProperty<*>): Int { operator fun getValue(x: X, property: KProperty<*>): Int {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
} }
} }
@@ -4,7 +4,7 @@ import kotlin.reflect.KProperty
class F { class F {
fun getValue(x: X, property: KProperty<*>): Int = 1 fun getValue(x: X, property: KProperty<*>): Int = 1
fun setValue(x: X, property: KProperty<*>, i: Int) { operator fun setValue(x: X, property: KProperty<*>, i: Int) {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
} }
} }