[IR] Mark IrConstructorImpl with an opt-in annotation
KT-59318
This commit is contained in:
committed by
Space Team
parent
2fab853700
commit
444dcae93d
+2
-1
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.ir.declarations.impl
|
|||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.ClassConstructorDescriptor
|
import org.jetbrains.kotlin.descriptors.ClassConstructorDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.DescriptorVisibility
|
import org.jetbrains.kotlin.descriptors.DescriptorVisibility
|
||||||
|
import org.jetbrains.kotlin.ir.IrImplementationDetail
|
||||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||||
import org.jetbrains.kotlin.ir.declarations.*
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrBody
|
import org.jetbrains.kotlin.ir.expressions.IrBody
|
||||||
@@ -18,7 +19,7 @@ import org.jetbrains.kotlin.ir.types.impl.ReturnTypeIsNotInitializedException
|
|||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
|
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
|
||||||
|
|
||||||
class IrConstructorImpl(
|
class IrConstructorImpl @IrImplementationDetail constructor(
|
||||||
override val startOffset: Int,
|
override val startOffset: Int,
|
||||||
override val endOffset: Int,
|
override val endOffset: Int,
|
||||||
override var origin: IrDeclarationOrigin,
|
override var origin: IrDeclarationOrigin,
|
||||||
|
|||||||
+7
-4
@@ -1142,14 +1142,17 @@ private class ObjCBlockPointerValuePassing(
|
|||||||
)
|
)
|
||||||
irClass.addChild(blockHolderField)
|
irClass.addChild(blockHolderField)
|
||||||
|
|
||||||
val constructor = IrConstructorImpl(
|
val constructor = context.irFactory.createConstructor(
|
||||||
startOffset, endOffset,
|
startOffset,
|
||||||
|
endOffset,
|
||||||
OBJC_BLOCK_FUNCTION_IMPL,
|
OBJC_BLOCK_FUNCTION_IMPL,
|
||||||
IrConstructorSymbolImpl(),
|
|
||||||
Name.special("<init>"),
|
Name.special("<init>"),
|
||||||
DescriptorVisibilities.PUBLIC,
|
DescriptorVisibilities.PUBLIC,
|
||||||
|
isInline = false,
|
||||||
|
isExpect = false,
|
||||||
irClass.defaultType,
|
irClass.defaultType,
|
||||||
isInline = false, isExternal = false, isPrimary = true, isExpect = false
|
IrConstructorSymbolImpl(),
|
||||||
|
isPrimary = true,
|
||||||
)
|
)
|
||||||
irClass.addChild(constructor)
|
irClass.addChild(constructor)
|
||||||
|
|
||||||
|
|||||||
+13
-5
@@ -11,11 +11,10 @@ import org.jetbrains.kotlin.ir.IrBuiltIns
|
|||||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||||
import org.jetbrains.kotlin.ir.builders.IrBuilder
|
import org.jetbrains.kotlin.ir.builders.IrBuilder
|
||||||
import org.jetbrains.kotlin.ir.declarations.*
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
import org.jetbrains.kotlin.ir.declarations.impl.IrConstructorImpl
|
import org.jetbrains.kotlin.ir.declarations.impl.IrFactoryImpl
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||||
import org.jetbrains.kotlin.ir.expressions.impl.IrInstanceInitializerCallImpl
|
import org.jetbrains.kotlin.ir.expressions.impl.IrInstanceInitializerCallImpl
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrConstructorSymbol
|
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
||||||
import org.jetbrains.kotlin.ir.types.impl.IrUninitializedType
|
import org.jetbrains.kotlin.ir.types.impl.IrUninitializedType
|
||||||
import org.jetbrains.kotlin.ir.util.*
|
import org.jetbrains.kotlin.ir.util.*
|
||||||
@@ -88,9 +87,18 @@ internal interface DescriptorToIrTranslationMixin {
|
|||||||
fun createConstructor(constructorDescriptor: ClassConstructorDescriptor): IrConstructor {
|
fun createConstructor(constructorDescriptor: ClassConstructorDescriptor): IrConstructor {
|
||||||
val irConstructor = symbolTable.descriptorExtension.declareConstructor(constructorDescriptor) {
|
val irConstructor = symbolTable.descriptorExtension.declareConstructor(constructorDescriptor) {
|
||||||
with(constructorDescriptor) {
|
with(constructorDescriptor) {
|
||||||
IrConstructorImpl(
|
symbolTable.irFactory.createConstructor(
|
||||||
SYNTHETIC_OFFSET, SYNTHETIC_OFFSET, IrDeclarationOrigin.IR_EXTERNAL_DECLARATION_STUB, it, name, visibility,
|
SYNTHETIC_OFFSET,
|
||||||
IrUninitializedType, isInline, isEffectivelyExternal(), isPrimary, isExpect
|
SYNTHETIC_OFFSET,
|
||||||
|
IrDeclarationOrigin.IR_EXTERNAL_DECLARATION_STUB,
|
||||||
|
name,
|
||||||
|
visibility,
|
||||||
|
isInline,
|
||||||
|
isExpect,
|
||||||
|
IrUninitializedType,
|
||||||
|
it,
|
||||||
|
isPrimary,
|
||||||
|
isEffectivelyExternal(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-18
@@ -12,7 +12,6 @@ import org.jetbrains.kotlin.descriptors.ClassKind
|
|||||||
import org.jetbrains.kotlin.descriptors.DescriptorVisibilities
|
import org.jetbrains.kotlin.descriptors.DescriptorVisibilities
|
||||||
import org.jetbrains.kotlin.ir.IrStatement
|
import org.jetbrains.kotlin.ir.IrStatement
|
||||||
import org.jetbrains.kotlin.ir.declarations.*
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
import org.jetbrains.kotlin.ir.declarations.impl.IrConstructorImpl
|
|
||||||
import org.jetbrains.kotlin.ir.declarations.impl.IrValueParameterImpl
|
import org.jetbrains.kotlin.ir.declarations.impl.IrValueParameterImpl
|
||||||
import org.jetbrains.kotlin.ir.expressions.*
|
import org.jetbrains.kotlin.ir.expressions.*
|
||||||
import org.jetbrains.kotlin.ir.expressions.impl.*
|
import org.jetbrains.kotlin.ir.expressions.impl.*
|
||||||
@@ -106,23 +105,23 @@ internal class EnumConstructorsLowering(val context: Context) : ClassLoweringPas
|
|||||||
val startOffset = constructor.startOffset
|
val startOffset = constructor.startOffset
|
||||||
val endOffset = constructor.endOffset
|
val endOffset = constructor.endOffset
|
||||||
val loweredConstructor =
|
val loweredConstructor =
|
||||||
IrConstructorImpl(
|
context.irFactory.createConstructor(
|
||||||
startOffset, endOffset,
|
startOffset,
|
||||||
constructor.origin,
|
endOffset,
|
||||||
IrConstructorSymbolImpl(),
|
constructor.origin,
|
||||||
constructor.name,
|
constructor.name,
|
||||||
DescriptorVisibilities.PROTECTED,
|
DescriptorVisibilities.PROTECTED,
|
||||||
constructor.returnType,
|
isInline = false,
|
||||||
isInline = false,
|
isExpect = false,
|
||||||
isExternal = false,
|
constructor.returnType,
|
||||||
isPrimary = constructor.isPrimary,
|
IrConstructorSymbolImpl(),
|
||||||
isExpect = false
|
isPrimary = constructor.isPrimary,
|
||||||
).apply {
|
).apply {
|
||||||
parent = constructor.parent
|
parent = constructor.parent
|
||||||
val body = constructor.body!!
|
val body = constructor.body!!
|
||||||
this.body = body // Will be transformed later.
|
this.body = body // Will be transformed later.
|
||||||
body.setDeclarationsParent(this)
|
body.setDeclarationsParent(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun createSynthesizedValueParameter(index: Int, name: String, type: IrType): IrValueParameter =
|
fun createSynthesizedValueParameter(index: Int, name: String, type: IrType): IrValueParameter =
|
||||||
IrValueParameterImpl(
|
IrValueParameterImpl(
|
||||||
|
|||||||
+6
-7
@@ -21,7 +21,6 @@ import org.jetbrains.kotlin.ir.IrStatement
|
|||||||
import org.jetbrains.kotlin.ir.builders.*
|
import org.jetbrains.kotlin.ir.builders.*
|
||||||
import org.jetbrains.kotlin.ir.builders.declarations.buildField
|
import org.jetbrains.kotlin.ir.builders.declarations.buildField
|
||||||
import org.jetbrains.kotlin.ir.declarations.*
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
import org.jetbrains.kotlin.ir.declarations.impl.IrConstructorImpl
|
|
||||||
import org.jetbrains.kotlin.ir.declarations.impl.IrFunctionImpl
|
import org.jetbrains.kotlin.ir.declarations.impl.IrFunctionImpl
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||||
import org.jetbrains.kotlin.ir.expressions.impl.*
|
import org.jetbrains.kotlin.ir.expressions.impl.*
|
||||||
@@ -420,17 +419,17 @@ internal class TestProcessor (val context: Context) {
|
|||||||
owner: IrClass,
|
owner: IrClass,
|
||||||
functions: Collection<TestFunction>,
|
functions: Collection<TestFunction>,
|
||||||
ignored: Boolean): IrConstructor =
|
ignored: Boolean): IrConstructor =
|
||||||
IrConstructorImpl(
|
context.irFactory.createConstructor(
|
||||||
testSuite.owner.startOffset, testSuite.owner.endOffset,
|
testSuite.owner.startOffset,
|
||||||
|
testSuite.owner.endOffset,
|
||||||
TEST_SUITE_GENERATED_MEMBER,
|
TEST_SUITE_GENERATED_MEMBER,
|
||||||
IrConstructorSymbolImpl(),
|
|
||||||
Name.special("<init>"),
|
Name.special("<init>"),
|
||||||
DescriptorVisibilities.PUBLIC,
|
DescriptorVisibilities.PUBLIC,
|
||||||
testSuite.starProjectedType,
|
|
||||||
isInline = false,
|
isInline = false,
|
||||||
isExternal = false,
|
isExpect = false,
|
||||||
|
testSuite.starProjectedType,
|
||||||
|
IrConstructorSymbolImpl(),
|
||||||
isPrimary = true,
|
isPrimary = true,
|
||||||
isExpect = false
|
|
||||||
).apply {
|
).apply {
|
||||||
parent = owner
|
parent = owner
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user