JVM_IR KT-41214 emit PermittedSubclasses on JDK17+

This commit is contained in:
Dmitry Petrov
2021-10-08 09:57:05 +03:00
committed by TeamCityServer
parent dca4a8e722
commit 146f0f4904
41 changed files with 695 additions and 43 deletions
@@ -22,6 +22,7 @@ internal fun PersistentIrGenerator.generateClass() {
descriptorType("InlineClassRepresentation") + "<" + import("IrSimpleType", "org.jetbrains.kotlin.ir.types") + ">?",
inlineClassRepresentationProto
)
val sealedSubclassesField = Field("sealedSubclasses", +"List<" + irSymbol("IrClassSymbol") + ">", sealedSubclassListProto)
writeFile("PersistentIrClass.kt", renderFile("org.jetbrains.kotlin.ir.declarations.persistent") {
lines(
@@ -79,6 +80,7 @@ internal fun PersistentIrGenerator.generateClass() {
modalityField.toPersistentField(+"modality"),
inlineClassRepresentationField.toPersistentField(+"null"),
+"override var attributeOwnerId: " + IrAttributeContainer + " = this",
sealedSubclassesField.toPersistentField(+"emptyList()"),
),
id,
)()
@@ -93,6 +95,7 @@ internal fun PersistentIrGenerator.generateClass() {
typeParametersField,
superTypesField,
inlineClassRepresentationField,
sealedSubclassesField,
)()
})
@@ -104,5 +107,6 @@ internal fun PersistentIrGenerator.generateClass() {
typeParametersField,
superTypesField,
inlineClassRepresentationField,
sealedSubclassesField,
)
}
@@ -152,6 +152,7 @@ internal object PersistentIrGenerator {
val valueParameterListProto = Proto("int64", "valueParameter", +"Long", IrValueParameterSymbol, fieldKind = FieldKind.REPEATED)
val typeParameterListProto = Proto("int64", "typeParameter", +"Long", IrTypeParameterSymbol, fieldKind = FieldKind.REPEATED)
val superTypeListProto = Proto("int32", "superType", +"Int", IrType, fieldKind = FieldKind.REPEATED)
val sealedSubclassListProto = Proto("int64", "sealedSubclass", +"Long", IrClassSymbol, fieldKind = FieldKind.REPEATED)
val typeProto = Proto("int32", "type", +"Int", IrType, fieldKind = FieldKind.REQUIRED)
val optionalTypeProto = Proto("int32", "type", +"Int", IrType, fieldKind = FieldKind.OPTIONAL)
val variableProto = Proto("IrVariable", "variable", protoVariable, IrVariable)
@@ -187,6 +188,7 @@ internal object PersistentIrGenerator {
valueParameterListProto,
typeParameterListProto,
superTypeListProto,
sealedSubclassListProto,
typeProto,
optionalTypeProto,
classProto,