Do not create KProperties field if there is no delegated properties.
This commit is contained in:
+7
-6
@@ -122,7 +122,6 @@ internal class PropertyDelegationLowering(val context: Context) : FileLoweringPa
|
|||||||
|
|
||||||
val kPropertiesField = createKPropertiesFieldDescriptor(irFile.packageFragmentDescriptor, genericArrayType.replace(kPropertyImplType))
|
val kPropertiesField = createKPropertiesFieldDescriptor(irFile.packageFragmentDescriptor, genericArrayType.replace(kPropertyImplType))
|
||||||
|
|
||||||
|
|
||||||
irFile.transformChildrenVoid(object : IrElementTransformerVoid() {
|
irFile.transformChildrenVoid(object : IrElementTransformerVoid() {
|
||||||
override fun visitFunction(declaration: IrFunction): IrStatement {
|
override fun visitFunction(declaration: IrFunction): IrStatement {
|
||||||
return super.visitFunction(declaration)
|
return super.visitFunction(declaration)
|
||||||
@@ -180,11 +179,13 @@ internal class PropertyDelegationLowering(val context: Context) : FileLoweringPa
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
irFile.declarations.add(0, IrFieldImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET,
|
if (kProperties.size > 0) {
|
||||||
DECLARATION_ORIGIN_KPROPERTIES_FOR_DELEGATION,
|
irFile.declarations.add(0, IrFieldImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET,
|
||||||
kPropertiesField,
|
DECLARATION_ORIGIN_KPROPERTIES_FOR_DELEGATION,
|
||||||
IrExpressionBodyImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET,
|
kPropertiesField,
|
||||||
context.createArrayOfExpression(kPropertyImplType, kProperties))))
|
IrExpressionBodyImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET,
|
||||||
|
context.createArrayOfExpression(kPropertyImplType, kProperties))))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private object DECLARATION_ORIGIN_KPROPERTIES_FOR_DELEGATION :
|
private object DECLARATION_ORIGIN_KPROPERTIES_FOR_DELEGATION :
|
||||||
|
|||||||
Reference in New Issue
Block a user