[Commonizer] Extract CirStandardTypes from CirTypeFactory
This commit is contained in:
+19
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.descriptors.commonizer.cir
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.Visibilities
|
||||
import org.jetbrains.kotlin.descriptors.commonizer.utils.ANY_CLASS_ID
|
||||
|
||||
object CirStandardTypes {
|
||||
val ANY: CirClassType = CirClassType.createInterned(
|
||||
classId = ANY_CLASS_ID,
|
||||
outerType = null,
|
||||
visibility = Visibilities.Public,
|
||||
arguments = emptyList(),
|
||||
isMarkedNullable = false
|
||||
)
|
||||
}
|
||||
-11
@@ -7,7 +7,6 @@ package org.jetbrains.kotlin.descriptors.commonizer.cir.factory
|
||||
|
||||
import gnu.trove.TIntObjectHashMap
|
||||
import kotlinx.metadata.*
|
||||
import org.jetbrains.kotlin.descriptors.Visibilities
|
||||
import org.jetbrains.kotlin.descriptors.commonizer.cir.*
|
||||
import org.jetbrains.kotlin.descriptors.commonizer.core.computeExpandedType
|
||||
import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirProvided
|
||||
@@ -19,16 +18,6 @@ import org.jetbrains.kotlin.descriptors.commonizer.utils.*
|
||||
import org.jetbrains.kotlin.types.Variance
|
||||
|
||||
object CirTypeFactory {
|
||||
object StandardTypes {
|
||||
val ANY: CirClassType = CirClassType.createInterned(
|
||||
classId = ANY_CLASS_ID,
|
||||
outerType = null,
|
||||
visibility = Visibilities.Public,
|
||||
arguments = emptyList(),
|
||||
isMarkedNullable = false
|
||||
)
|
||||
}
|
||||
|
||||
fun create(source: KmType, typeResolver: CirTypeResolver): CirType {
|
||||
@Suppress("NAME_SHADOWING")
|
||||
val source = source.abbreviatedType ?: source
|
||||
|
||||
+1
-2
@@ -10,7 +10,6 @@ import kotlinx.metadata.klib.*
|
||||
import org.jetbrains.kotlin.backend.common.serialization.metadata.DynamicTypeDeserializer
|
||||
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.commonizer.cir.*
|
||||
import org.jetbrains.kotlin.descriptors.commonizer.cir.factory.CirTypeFactory
|
||||
import org.jetbrains.kotlin.descriptors.commonizer.core.computeExpandedType
|
||||
import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.*
|
||||
import org.jetbrains.kotlin.descriptors.commonizer.metadata.TypeAliasExpansion.*
|
||||
@@ -103,7 +102,7 @@ internal fun CirClass.buildClass(
|
||||
|
||||
val supertypes = supertypes
|
||||
if (supertypes.isEmpty() && className !in SPECIAL_CLASS_WITHOUT_SUPERTYPES_CLASS_NAMES)
|
||||
clazz.supertypes += CirTypeFactory.StandardTypes.ANY.buildType(context)
|
||||
clazz.supertypes += CirStandardTypes.ANY.buildType(context)
|
||||
else
|
||||
supertypes.mapTo(clazz.supertypes) { it.buildType(context) }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user