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