JVM_IR: remove a descriptor-related hack from InterfaceLowering

It will break with FIR.
This commit is contained in:
pyos
2020-09-15 16:10:28 +02:00
committed by Alexander Udalov
parent dd913ef450
commit 9b157fd291
2 changed files with 3 additions and 8 deletions
@@ -41,7 +41,9 @@ class DescriptorMetadataSerializer(
if (localDelegatedProperties != null && localDelegatedProperties.isNotEmpty()) {
context.state.bindingTrace.record(
CodegenBinding.DELEGATED_PROPERTIES_WITH_METADATA,
type,
// When serializing metadata for interfaces, `JvmSerializerExtension.serializeClass`
// looks at `$DefaultImpls` for some reason that's probably related to the old backend.
if (irClass.isInterface) context.typeMapper.mapClass(context.cachedDeclarations.getDefaultImplsClass(irClass)) else type,
localDelegatedProperties.mapNotNull { (it.owner.metadata as? DescriptorMetadataSource.LocalDelegatedProperty)?.descriptor }
)
}
@@ -155,13 +155,6 @@ internal class InterfaceLowering(val context: JvmBackendContext) : IrElementTran
val defaultImplsIrClass = context.cachedDeclarations.getDefaultImplsClass(irClass)
// Move metadata for local delegated properties from the interface to DefaultImpls, since this is where kotlin-reflect looks for it.
val localDelegatedProperties = context.localDelegatedProperties[irClass.attributeOwnerId as IrClass]
if (localDelegatedProperties != null) {
context.localDelegatedProperties[defaultImplsIrClass.attributeOwnerId as IrClass] = localDelegatedProperties
context.localDelegatedProperties[irClass.attributeOwnerId as IrClass] = emptyList<IrLocalDelegatedPropertySymbol>()
}
// Move $$delegatedProperties array and $assertionsDisabled field
for (field in irClass.declarations.filterIsInstance<IrField>()) {
if (field.origin != JvmLoweredDeclarationOrigin.GENERATED_PROPERTY_REFERENCE && field.origin != JvmLoweredDeclarationOrigin.GENERATED_ASSERTION_ENABLED_FIELD)