[IR] Mark IrFieldImpl with an opt-in annotation

KT-59318
This commit is contained in:
Sergej Jaskiewicz
2023-12-07 16:54:46 +01:00
committed by Space Team
parent cd014c57a5
commit e1d03f6540
5 changed files with 20 additions and 22 deletions
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.ir.declarations.impl
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
import org.jetbrains.kotlin.descriptors.DescriptorVisibility
import org.jetbrains.kotlin.ir.IrImplementationDetail
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
@@ -16,7 +17,7 @@ import org.jetbrains.kotlin.ir.symbols.IrPropertySymbol
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.name.Name
class IrFieldImpl(
class IrFieldImpl @IrImplementationDetail constructor(
override val startOffset: Int,
override val endOffset: Int,
override var origin: IrDeclarationOrigin,
@@ -1129,16 +1129,16 @@ private class ObjCBlockPointerValuePassing(
irClass.superTypes += stubs.irBuiltIns.anyType
irClass.superTypes += functionType.makeNotNull()
val blockHolderField = IrFieldImpl(
startOffset, endOffset,
val blockHolderField = context.irFactory.createField(
startOffset,
endOffset,
OBJC_BLOCK_FUNCTION_IMPL,
IrFieldSymbolImpl(),
Name.identifier("blockHolder"),
stubs.irBuiltIns.anyType,
DescriptorVisibilities.PRIVATE,
IrFieldSymbolImpl(),
stubs.irBuiltIns.anyType,
isFinal = true,
isStatic = false,
isExternal = false
)
irClass.addChild(blockHolderField)
@@ -19,7 +19,6 @@ import org.jetbrains.kotlin.ir.IrStatement
import org.jetbrains.kotlin.ir.builders.*
import org.jetbrains.kotlin.ir.builders.declarations.buildFun
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.declarations.impl.IrFieldImpl
import org.jetbrains.kotlin.ir.declarations.impl.IrPropertyImpl
import org.jetbrains.kotlin.ir.expressions.*
import org.jetbrains.kotlin.ir.expressions.impl.IrCallImpl
@@ -381,16 +380,15 @@ private class InlineClassTransformer(private val context: Context) : IrBuildingT
val startOffset = declaration.startOffset
val endOffset = declaration.endOffset
val irField = IrFieldImpl(
val irField = context.irFactory.createField(
startOffset,
endOffset,
IrDeclarationOrigin.DEFINED,
IrFieldSymbolImpl(),
Name.identifier("value"),
declaration.defaultType,
DescriptorVisibilities.PRIVATE,
IrFieldSymbolImpl(),
declaration.defaultType,
isFinal = true,
isExternal = false,
isStatic = false,
)
irField.parent = declaration
@@ -16,7 +16,6 @@ import org.jetbrains.kotlin.backend.konan.ir.buildSimpleAnnotation
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.ir.builders.*
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.declarations.impl.IrFieldImpl
import org.jetbrains.kotlin.ir.expressions.*
import org.jetbrains.kotlin.ir.expressions.impl.*
import org.jetbrains.kotlin.ir.symbols.impl.IrFieldSymbolImpl
@@ -70,15 +69,15 @@ internal class PropertyDelegationLowering(val generationState: NativeGenerationS
val generatedClasses = mutableListOf<IrClass>()
fun kPropertyField(value: IrExpressionBody, id:Int) =
IrFieldImpl(
SYNTHETIC_OFFSET, SYNTHETIC_OFFSET,
context.irFactory.createField(
SYNTHETIC_OFFSET,
SYNTHETIC_OFFSET,
DECLARATION_ORIGIN_KPROPERTIES_FOR_DELEGATION,
IrFieldSymbolImpl(),
"KPROPERTY${id}".synthesizedName,
value.expression.type,
DescriptorVisibilities.PRIVATE,
IrFieldSymbolImpl(),
value.expression.type,
isFinal = true,
isExternal = false,
isStatic = true,
).apply {
parent = irFile
@@ -169,15 +169,15 @@ private class InteropLoweringPart1(val generationState: NativeGenerationState) :
}
private fun IrFile.addTopLevelInitializer(expression: IrExpression, context: KonanBackendContext, threadLocal: Boolean, eager: Boolean) {
val irField = IrFieldImpl(
expression.startOffset, expression.endOffset,
val irField = context.irFactory.createField(
expression.startOffset,
expression.endOffset,
IrDeclarationOrigin.DEFINED,
IrFieldSymbolImpl(),
"topLevelInitializer${topLevelInitializersCounter++}".synthesizedName,
expression.type,
DescriptorVisibilities.PRIVATE,
IrFieldSymbolImpl(),
expression.type,
isFinal = true,
isExternal = false,
isStatic = true,
).apply {
expression.setDeclarationsParent(this)