Some more use of .propertyIfAccessor .
This commit is contained in:
committed by
alexander-gorshenev
parent
8a0b494c2e
commit
2ae88c9731
+6
-1
@@ -65,6 +65,11 @@ internal val DeclarationDescriptor.propertyIfAccessor
|
||||
this.correspondingProperty
|
||||
else this
|
||||
|
||||
internal val CallableMemberDescriptor.propertyIfAccessor
|
||||
get() = if (this is PropertyAccessorDescriptor)
|
||||
this.correspondingProperty
|
||||
else this
|
||||
|
||||
internal val FunctionDescriptor.deserializedPropertyIfAccessor: DeserializedCallableMemberDescriptor
|
||||
get() {
|
||||
val member = this.propertyIfAccessor
|
||||
@@ -74,7 +79,7 @@ internal val FunctionDescriptor.deserializedPropertyIfAccessor: DeserializedCall
|
||||
error("Unexpected deserializable callable descriptor")
|
||||
}
|
||||
|
||||
internal val DeclarationDescriptor.isDeserializableCallable
|
||||
internal val CallableMemberDescriptor.isDeserializableCallable
|
||||
get () = (this.propertyIfAccessor is DeserializedCallableMemberDescriptor)
|
||||
|
||||
|
||||
|
||||
+7
-13
@@ -17,6 +17,7 @@
|
||||
package org.jetbrains.kotlin.backend.konan.serialization
|
||||
|
||||
import org.jetbrains.kotlin.backend.konan.Context
|
||||
import org.jetbrains.kotlin.backend.konan.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.impl.LocalVariableDescriptor
|
||||
import org.jetbrains.kotlin.ir.descriptors.IrTemporaryVariableDescriptor
|
||||
@@ -80,18 +81,15 @@ internal class IrDescriptorSerializer(
|
||||
|
||||
fun functionDescriptorSpecifics(descriptor: FunctionDescriptor, proto: KonanIr.KotlinDescriptor.Builder) {
|
||||
|
||||
descriptor.valueParameters.forEach {
|
||||
proto.addValueParameter(serializeDescriptor(it))
|
||||
}
|
||||
|
||||
val typeParameters = if (descriptor is PropertyAccessorDescriptor)
|
||||
descriptor.correspondingProperty.typeParameters
|
||||
else descriptor.typeParameters
|
||||
|
||||
val typeParameters = descriptor.propertyIfAccessor.typeParameters
|
||||
typeParameters.forEach {
|
||||
proto.addTypeParameter(serializeDescriptor(it))
|
||||
}
|
||||
|
||||
descriptor.valueParameters.forEach {
|
||||
proto.addValueParameter(serializeDescriptor(it))
|
||||
}
|
||||
|
||||
// Allocate two indicies for the receivers.
|
||||
// They are not deserialized from protobuf,
|
||||
// just recreated together with their function.
|
||||
@@ -135,11 +133,7 @@ internal class IrDescriptorSerializer(
|
||||
val index = descriptorTable.indexByValue(descriptor)
|
||||
// For getters and setters we use
|
||||
// the *property* original index.
|
||||
val originalIndex = if (descriptor is PropertyAccessorDescriptor) {
|
||||
descriptorTable.indexByValue(descriptor.correspondingProperty.original)
|
||||
} else {
|
||||
descriptorTable.indexByValue(descriptor.original)
|
||||
}
|
||||
val originalIndex = descriptorTable.indexByValue(descriptor.propertyIfAccessor.original)
|
||||
|
||||
context.log{"index = $index"}
|
||||
context.log{"originalIndex = $originalIndex"}
|
||||
|
||||
+1
@@ -304,6 +304,7 @@ internal class KonanSerializationUtil(val context: Context) {
|
||||
when (descriptor) {
|
||||
is FunctionDescriptor ->
|
||||
proto.setFunction(serializer.functionProto(descriptor))
|
||||
|
||||
is PropertyDescriptor ->
|
||||
proto.setProperty(serializer.propertyProto(descriptor))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user