IR: add IrClass.getInlineClassRepresentation, serialize/deserialize it
The change in FirDeclarationUtil is needed because in case of unsigned types loaded from the standard library, the primary constructor for some reason is not the first, but the second in the list of constructors.
This commit is contained in:
+16
@@ -182,6 +182,22 @@ class FirElementSerializer private constructor(
|
||||
builder.typeTable = typeTableProto
|
||||
}
|
||||
|
||||
val representation = (klass as? FirRegularClass)?.getInlineClassUnderlyingParameter()
|
||||
if (representation != null) {
|
||||
builder.inlineClassUnderlyingPropertyName = getSimpleNameIndex(representation.name)
|
||||
|
||||
val property = callableMembers.single {
|
||||
it is FirProperty && it.receiverTypeRef == null && it.name == representation.name
|
||||
}
|
||||
if (!property.visibility.isPublicAPI) {
|
||||
if (useTypeTable()) {
|
||||
builder.inlineClassUnderlyingTypeId = typeId(representation.returnTypeRef)
|
||||
} else {
|
||||
builder.setInlineClassUnderlyingType(typeProto(representation.returnTypeRef))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (versionRequirementTable == null) error("Version requirements must be serialized for classes: ${klass.render()}")
|
||||
|
||||
builder.addAllVersionRequirement(versionRequirementTable.serializeVersionRequirements(klass))
|
||||
|
||||
Reference in New Issue
Block a user