[Commonizer] Minor. Reorganize CirClass.supertypes
This commit is contained in:
@@ -15,9 +15,7 @@ interface CirClass : CirClassifier, CirContainingClass {
|
|||||||
val isValue: Boolean
|
val isValue: Boolean
|
||||||
val isInner: Boolean
|
val isInner: Boolean
|
||||||
val isExternal: Boolean
|
val isExternal: Boolean
|
||||||
val supertypes: Collection<CirType>
|
var supertypes: List<CirType>
|
||||||
|
|
||||||
fun setSupertypes(supertypes: Collection<CirType>)
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
@@ -65,13 +63,12 @@ data class CirClassImpl(
|
|||||||
override val isInner: Boolean,
|
override val isInner: Boolean,
|
||||||
override val isExternal: Boolean,
|
override val isExternal: Boolean,
|
||||||
) : CirClass {
|
) : CirClass {
|
||||||
private var _supertypes: Collection<CirType>? = null
|
private var _supertypes: List<CirType>? = null
|
||||||
|
|
||||||
override val supertypes: Collection<CirType>
|
override var supertypes: List<CirType>
|
||||||
get() = _supertypes.orEmpty()
|
get() = _supertypes ?: error("${::supertypes.name} has not been initialized yet")
|
||||||
|
set(value) {
|
||||||
override fun setSupertypes(supertypes: Collection<CirType>) {
|
check(_supertypes == null) { "Re-initialization of ${::supertypes.name}" }
|
||||||
check(_supertypes == null)
|
_supertypes = value
|
||||||
_supertypes = supertypes
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -20,8 +20,9 @@ object CirClassRecursionMarker : CirClass, CirRecursionMarker {
|
|||||||
override val isValue get() = unsupported()
|
override val isValue get() = unsupported()
|
||||||
override val isInner get() = unsupported()
|
override val isInner get() = unsupported()
|
||||||
override val isExternal get() = unsupported()
|
override val isExternal get() = unsupported()
|
||||||
override val supertypes get() = unsupported()
|
override var supertypes: List<CirType>
|
||||||
override fun setSupertypes(supertypes: Collection<CirType>) = unsupported()
|
get() = unsupported()
|
||||||
|
set(_) = unsupported()
|
||||||
}
|
}
|
||||||
|
|
||||||
object CirClassifierRecursionMarker : CirClassifier, CirRecursionMarker {
|
object CirClassifierRecursionMarker : CirClassifier, CirRecursionMarker {
|
||||||
|
|||||||
+1
-1
@@ -147,6 +147,6 @@ internal class CommonizationVisitor(
|
|||||||
commonize(supertypesGroup, TypeCommonizer(classifiers))
|
commonize(supertypesGroup, TypeCommonizer(classifiers))
|
||||||
}.orEmpty()
|
}.orEmpty()
|
||||||
|
|
||||||
setSupertypes(commonSupertypes)
|
supertypes = commonSupertypes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -264,7 +264,7 @@ object CirDeserializers {
|
|||||||
isInner = Flag.Class.IS_INNER(source.flags),
|
isInner = Flag.Class.IS_INNER(source.flags),
|
||||||
isExternal = Flag.Class.IS_EXTERNAL(source.flags)
|
isExternal = Flag.Class.IS_EXTERNAL(source.flags)
|
||||||
).apply {
|
).apply {
|
||||||
setSupertypes(source.filteredSupertypes.compactMap { type(it, typeResolver) })
|
supertypes = source.filteredSupertypes.compactMap { type(it, typeResolver) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun defaultEnumEntry(
|
fun defaultEnumEntry(
|
||||||
@@ -294,7 +294,7 @@ object CirDeserializers {
|
|||||||
arguments = emptyList(),
|
arguments = emptyList(),
|
||||||
isMarkedNullable = false
|
isMarkedNullable = false
|
||||||
)
|
)
|
||||||
setSupertypes(listOf(enumClassType))
|
supertypes = listOf(enumClassType)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
|
|||||||
Reference in New Issue
Block a user