Refactor AnnotationImplementationLowering
- Replaced UNDEFINED_OFFSET with SYNTHETIC_OFFSET, it's required by Native backend codegen - Fixed missing overridden symbols - Enforce adding fakeoverrides for members not overridden by backend - Support more points for platform customisation
This commit is contained in:
@@ -7,7 +7,6 @@ package org.jetbrains.kotlin.ir.util
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
||||
import org.jetbrains.kotlin.ir.builders.*
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.declarations.impl.IrVariableImpl
|
||||
@@ -36,7 +35,8 @@ abstract class DataClassMembersGenerator(
|
||||
val context: IrGeneratorContext,
|
||||
val symbolTable: ReferenceSymbolTable,
|
||||
val irClass: IrClass,
|
||||
val origin: IrDeclarationOrigin
|
||||
val origin: IrDeclarationOrigin,
|
||||
val forbidDirectFieldAccess: Boolean = false
|
||||
) {
|
||||
private val irPropertiesByDescriptor: Map<PropertyDescriptor, IrProperty> =
|
||||
irClass.properties.associateBy { it.descriptor }
|
||||
@@ -49,8 +49,8 @@ abstract class DataClassMembersGenerator(
|
||||
}
|
||||
|
||||
private inner class MemberFunctionBuilder(
|
||||
startOffset: Int = UNDEFINED_OFFSET,
|
||||
endOffset: Int = UNDEFINED_OFFSET,
|
||||
startOffset: Int = SYNTHETIC_OFFSET,
|
||||
endOffset: Int = SYNTHETIC_OFFSET,
|
||||
val irFunction: IrFunction
|
||||
) : IrBlockBodyBuilder(context, Scope(irFunction.symbol), startOffset, endOffset) {
|
||||
inline fun addToClass(builder: MemberFunctionBuilder.(IrFunction) -> Unit): IrFunction {
|
||||
@@ -89,7 +89,7 @@ abstract class DataClassMembersGenerator(
|
||||
// data classes and corresponding properties can be non-final.
|
||||
// We should use getters for such properties (see KT-41284).
|
||||
val backingField = property.backingField
|
||||
return if (property.modality == Modality.FINAL && backingField != null) {
|
||||
return if (!forbidDirectFieldAccess && property.modality == Modality.FINAL && backingField != null) {
|
||||
irGetField(receiver, backingField)
|
||||
} else {
|
||||
irCall(property.getter!!).apply {
|
||||
|
||||
Reference in New Issue
Block a user