Get rid of descriptors in PropertiesLowering
This commit is contained in:
+13
-12
@@ -6,6 +6,7 @@
|
|||||||
package org.jetbrains.kotlin.backend.common.lower
|
package org.jetbrains.kotlin.backend.common.lower
|
||||||
|
|
||||||
import org.jetbrains.kotlin.backend.common.FileLoweringPass
|
import org.jetbrains.kotlin.backend.common.FileLoweringPass
|
||||||
|
import org.jetbrains.kotlin.descriptors.ClassKind
|
||||||
import org.jetbrains.kotlin.ir.IrStatement
|
import org.jetbrains.kotlin.ir.IrStatement
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrClass
|
import org.jetbrains.kotlin.ir.declarations.IrClass
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
|
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
|
||||||
@@ -25,25 +26,25 @@ class PropertiesLowering : IrElementTransformerVoid(), FileLoweringPass {
|
|||||||
|
|
||||||
override fun visitFile(declaration: IrFile): IrFile {
|
override fun visitFile(declaration: IrFile): IrFile {
|
||||||
declaration.transformChildrenVoid(this)
|
declaration.transformChildrenVoid(this)
|
||||||
declaration.declarations.transformFlat { lowerProperty(it) }
|
declaration.declarations.transformFlat { lowerProperty(it, ClassKind.CLASS) }
|
||||||
return declaration
|
return declaration
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun visitClass(declaration: IrClass): IrStatement {
|
override fun visitClass(declaration: IrClass): IrStatement {
|
||||||
declaration.transformChildrenVoid(this)
|
declaration.transformChildrenVoid(this)
|
||||||
declaration.declarations.transformFlat { lowerProperty(it) }
|
declaration.declarations.transformFlat { lowerProperty(it, declaration.kind) }
|
||||||
return declaration
|
return declaration
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun lowerProperty(declaration: IrDeclaration): List<IrDeclaration>? =
|
private fun lowerProperty(declaration: IrDeclaration, kind: ClassKind): List<IrDeclaration>? =
|
||||||
if (declaration is IrProperty)
|
if (declaration is IrProperty)
|
||||||
ArrayList<IrDeclaration>(3).apply {
|
ArrayList<IrDeclaration>(3).apply {
|
||||||
if (!DescriptorUtils.isAnnotationClass(declaration.descriptor.containingDeclaration)) {
|
if (kind != ClassKind.ANNOTATION_CLASS) {
|
||||||
addIfNotNull(declaration.backingField)
|
addIfNotNull(declaration.backingField)
|
||||||
}
|
|
||||||
addIfNotNull(declaration.getter)
|
|
||||||
addIfNotNull(declaration.setter)
|
|
||||||
}
|
}
|
||||||
else
|
addIfNotNull(declaration.getter)
|
||||||
null
|
addIfNotNull(declaration.setter)
|
||||||
|
}
|
||||||
|
else
|
||||||
|
null
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user