Use new getInlineClassRepresentation in some utilities

This commit is contained in:
Alexander Udalov
2021-03-23 14:51:31 +01:00
parent 7fb3f48c67
commit 4c7f207309
10 changed files with 74 additions and 97 deletions
@@ -165,17 +165,18 @@ class DescriptorSerializer private constructor(
builder.typeTable = typeTableProto
}
classDescriptor.underlyingRepresentation()?.let { parameter ->
builder.inlineClassUnderlyingPropertyName = getSimpleNameIndex(parameter.name)
val representation = classDescriptor.inlineClassRepresentation
if (representation != null) {
builder.inlineClassUnderlyingPropertyName = getSimpleNameIndex(representation.underlyingPropertyName)
val property = callableMembers.single {
it is PropertyDescriptor && it.extensionReceiverParameter == null && it.name == parameter.name
it is PropertyDescriptor && it.extensionReceiverParameter == null && it.name == representation.underlyingPropertyName
}
if (!property.visibility.isPublicAPI) {
if (useTypeTable()) {
builder.inlineClassUnderlyingTypeId = typeId(parameter.type)
builder.inlineClassUnderlyingTypeId = typeId(representation.underlyingType)
} else {
builder.setInlineClassUnderlyingType(type(parameter.type))
builder.setInlineClassUnderlyingType(type(representation.underlyingType))
}
}
}