JVM_IR: support codegen of property delegate methods
The purpose of a property-related method is now determined by its origin; codegen no longer assumes all methods with Property metadata source are `getX$annotations`.
This commit is contained in:
+2
@@ -35,6 +35,8 @@ public final class JvmSerializationBindings {
|
||||
SerializationMappingSlice.create();
|
||||
public static final SerializationMappingSlice<PropertyDescriptor, Method> SYNTHETIC_METHOD_FOR_PROPERTY =
|
||||
SerializationMappingSlice.create();
|
||||
public static final SerializationMappingSlice<PropertyDescriptor, Method> DELEGATE_METHOD_FOR_PROPERTY =
|
||||
SerializationMappingSlice.create();
|
||||
|
||||
public static final class SerializationMappingSlice<K, V> extends BasicWritableSlice<K, V> {
|
||||
public SerializationMappingSlice() {
|
||||
|
||||
+8
@@ -255,12 +255,15 @@ class JvmSerializerExtension @JvmOverloads constructor(
|
||||
|
||||
val field = getBinding(FIELD_FOR_PROPERTY, descriptor)
|
||||
val syntheticMethod = getBinding(SYNTHETIC_METHOD_FOR_PROPERTY, descriptor)
|
||||
val delegateMethod = getBinding(DELEGATE_METHOD_FOR_PROPERTY, descriptor)
|
||||
assert(descriptor.isDelegated || delegateMethod == null) { "non-delegated property $descriptor has delegate method" }
|
||||
|
||||
val signature = signatureSerializer.propertySignature(
|
||||
descriptor,
|
||||
field?.second,
|
||||
field?.first?.descriptor,
|
||||
if (syntheticMethod != null) signatureSerializer.methodSignature(null, syntheticMethod) else null,
|
||||
if (delegateMethod != null) signatureSerializer.methodSignature(null, delegateMethod) else null,
|
||||
if (getterMethod != null) signatureSerializer.methodSignature(null, getterMethod) else null,
|
||||
if (setterMethod != null) signatureSerializer.methodSignature(null, setterMethod) else null
|
||||
)
|
||||
@@ -359,6 +362,7 @@ class JvmSerializerExtension @JvmOverloads constructor(
|
||||
fieldName: String?,
|
||||
fieldDesc: String?,
|
||||
syntheticMethod: JvmProtoBuf.JvmMethodSignature?,
|
||||
delegateMethod: JvmProtoBuf.JvmMethodSignature?,
|
||||
getter: JvmProtoBuf.JvmMethodSignature?,
|
||||
setter: JvmProtoBuf.JvmMethodSignature?
|
||||
): JvmProtoBuf.JvmPropertySignature? {
|
||||
@@ -373,6 +377,10 @@ class JvmSerializerExtension @JvmOverloads constructor(
|
||||
signature.syntheticMethod = syntheticMethod
|
||||
}
|
||||
|
||||
if (delegateMethod != null) {
|
||||
signature.delegateMethod = delegateMethod
|
||||
}
|
||||
|
||||
if (getter != null) {
|
||||
signature.getter = getter
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user