Add underlying property name & type for inline class to kotlinx-metadata

#KT-45635 Fixed
This commit is contained in:
Alexander Udalov
2021-03-23 11:23:51 +01:00
parent 9b5bbb95e7
commit c4b2b7e0da
8 changed files with 84 additions and 0 deletions
@@ -23,6 +23,12 @@ import org.jetbrains.kotlin.metadata.ProtoBuf
fun ProtoBuf.Class.supertypes(typeTable: TypeTable): List<ProtoBuf.Type> =
supertypeList.takeIf(Collection<*>::isNotEmpty) ?: supertypeIdList.map { typeTable[it] }
fun ProtoBuf.Class.inlineClassUnderlyingType(typeTable: TypeTable): ProtoBuf.Type? = when {
hasInlineClassUnderlyingType() -> inlineClassUnderlyingType
hasInlineClassUnderlyingTypeId() -> typeTable[inlineClassUnderlyingTypeId]
else -> null
}
fun ProtoBuf.Type.Argument.type(typeTable: TypeTable): ProtoBuf.Type? = when {
hasType() -> type
hasTypeId() -> typeTable[typeId]