[IR] Generify lowerings
#KT-1179
This commit is contained in:
committed by
teamcity
parent
22b2554368
commit
282ab398c6
@@ -40,6 +40,8 @@ abstract class IrClass :
|
||||
|
||||
abstract var inlineClassRepresentation: InlineClassRepresentation<IrSimpleType>?
|
||||
|
||||
abstract var multiFieldValueClassRepresentation: MultiFieldValueClassRepresentation<IrSimpleType>?
|
||||
|
||||
abstract var sealedSubclasses: List<IrClassSymbol>
|
||||
|
||||
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
|
||||
|
||||
@@ -17,6 +17,7 @@ import org.jetbrains.kotlin.metadata.ProtoBuf
|
||||
import org.jetbrains.kotlin.metadata.deserialization.NameResolver
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedClassDescriptor
|
||||
import org.jetbrains.kotlin.types.SimpleType
|
||||
|
||||
class IrLazyClass(
|
||||
override val startOffset: Int,
|
||||
@@ -101,9 +102,14 @@ class IrLazyClass(
|
||||
}
|
||||
|
||||
override var inlineClassRepresentation: InlineClassRepresentation<IrSimpleType>? by lazyVar(stubGenerator.lock) {
|
||||
descriptor.inlineClassRepresentation?.mapUnderlyingType {
|
||||
it.toIrType() as? IrSimpleType ?: error("Inline class underlying type is not a simple type: ${render()}")
|
||||
}
|
||||
descriptor.inlineClassRepresentation?.mapUnderlyingType(::simplyTypeToIrOrThrow)
|
||||
}
|
||||
|
||||
private fun simplyTypeToIrOrThrow(it: SimpleType) =
|
||||
it.toIrType() as? IrSimpleType ?: error("Inline class underlying type is not a simple type: ${render()}")
|
||||
|
||||
override var multiFieldValueClassRepresentation: MultiFieldValueClassRepresentation<IrSimpleType>? by lazyVar(stubGenerator.lock) {
|
||||
descriptor.multiFieldValueClassRepresentation?.mapUnderlyingType(::simplyTypeToIrOrThrow)
|
||||
}
|
||||
|
||||
override var attributeOwnerId: IrAttributeContainer = this
|
||||
|
||||
@@ -629,6 +629,9 @@ open class IrBasedClassDescriptor(owner: IrClass) : ClassDescriptor, IrBasedDecl
|
||||
override fun getInlineClassRepresentation(): InlineClassRepresentation<SimpleType>? =
|
||||
owner.inlineClassRepresentation?.mapUnderlyingType { it.toIrBasedKotlinType() as SimpleType }
|
||||
|
||||
override fun getMultiFieldValueClassRepresentation(): MultiFieldValueClassRepresentation<SimpleType>? =
|
||||
owner.multiFieldValueClassRepresentation?.mapUnderlyingType { it.toIrBasedKotlinType() as SimpleType }
|
||||
|
||||
override fun getOriginal() = this
|
||||
|
||||
override fun isExpect() = owner.isExpect
|
||||
@@ -759,6 +762,8 @@ open class IrBasedEnumEntryDescriptor(owner: IrEnumEntry) : ClassDescriptor, IrB
|
||||
|
||||
override fun getInlineClassRepresentation(): InlineClassRepresentation<SimpleType>? = TODO("not implemented")
|
||||
|
||||
override fun getMultiFieldValueClassRepresentation(): MultiFieldValueClassRepresentation<SimpleType>? = TODO("not implemented")
|
||||
|
||||
override fun getOriginal() = this
|
||||
|
||||
override fun isExpect() = false
|
||||
|
||||
Reference in New Issue
Block a user