Remove obsolete and unused descriptors and utils
This commit is contained in:
+15
-45
@@ -26,12 +26,23 @@ import org.jetbrains.kotlin.types.TypeProjectionImpl
|
|||||||
import org.jetbrains.kotlin.types.TypeSubstitutor
|
import org.jetbrains.kotlin.types.TypeSubstitutor
|
||||||
import org.jetbrains.kotlin.types.replace
|
import org.jetbrains.kotlin.types.replace
|
||||||
|
|
||||||
|
val String.synthesizedName: Name get() = Name.identifier(this.synthesizedString)
|
||||||
|
|
||||||
|
val String.synthesizedString: String get() = "\$$this"
|
||||||
|
|
||||||
|
val DeclarationDescriptor.propertyIfAccessor: DeclarationDescriptor
|
||||||
|
get() = if (this is PropertyAccessorDescriptor)
|
||||||
|
this.correspondingProperty
|
||||||
|
else this
|
||||||
|
|
||||||
val CallableDescriptor.isSuspend: Boolean
|
val CallableDescriptor.isSuspend: Boolean
|
||||||
get() = this is FunctionDescriptor && isSuspend
|
get() = this is FunctionDescriptor && isSuspend
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return naturally-ordered list of all parameters available inside the function body.
|
* @return naturally-ordered list of all parameters available inside the function body.
|
||||||
*/
|
*/
|
||||||
|
// Used in Kotlin/Native
|
||||||
|
@Suppress("unused")
|
||||||
val CallableDescriptor.allParameters: List<ParameterDescriptor>
|
val CallableDescriptor.allParameters: List<ParameterDescriptor>
|
||||||
get() = if (this is ConstructorDescriptor) {
|
get() = if (this is ConstructorDescriptor) {
|
||||||
listOf(this.constructedClass.thisAsReceiverParameter) + explicitParameters
|
listOf(this.constructedClass.thisAsReceiverParameter) + explicitParameters
|
||||||
@@ -59,58 +70,17 @@ val CallableDescriptor.explicitParameters: List<ParameterDescriptor>
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
fun KotlinType.replace(types: List<KotlinType>) = this.replace(types.map(::TypeProjectionImpl))
|
// Used in Kotlin/Native
|
||||||
|
@Suppress("unused")
|
||||||
fun FunctionDescriptor.substitute(vararg types: KotlinType): FunctionDescriptor {
|
fun FunctionDescriptor.substitute(vararg types: KotlinType): FunctionDescriptor {
|
||||||
val typeSubstitutor = TypeSubstitutor.create(
|
val typeSubstitutor = TypeSubstitutor.create(
|
||||||
typeParameters
|
typeParameters
|
||||||
.withIndex()
|
|
||||||
.associateBy({ it.value.typeConstructor }, { TypeProjectionImpl(types[it.index]) })
|
|
||||||
)
|
|
||||||
return substitute(typeSubstitutor)!!
|
|
||||||
}
|
|
||||||
|
|
||||||
fun FunctionDescriptor.substitute(typeArguments: Map<TypeParameterDescriptor, KotlinType>): FunctionDescriptor {
|
|
||||||
val typeSubstitutor = TypeSubstitutor.create(
|
|
||||||
typeParameters.associateBy({ it.typeConstructor }, { TypeProjectionImpl(typeArguments[it]!!) })
|
|
||||||
)
|
|
||||||
return substitute(typeSubstitutor)!!
|
|
||||||
}
|
|
||||||
|
|
||||||
fun ClassDescriptor.getFunction(name: String, types: List<KotlinType>): FunctionDescriptor {
|
|
||||||
val typeSubstitutor = TypeSubstitutor.create(
|
|
||||||
declaredTypeParameters
|
|
||||||
.withIndex()
|
|
||||||
.associateBy({ it.value.typeConstructor }, { TypeProjectionImpl(types[it.index]) })
|
|
||||||
)
|
|
||||||
return unsubstitutedMemberScope
|
|
||||||
.getContributedFunctions(Name.identifier(name), NoLookupLocation.FROM_BACKEND).single().substitute(typeSubstitutor)!!
|
|
||||||
}
|
|
||||||
|
|
||||||
fun ClassDescriptor.getStaticFunction(name: String, types: List<KotlinType>): FunctionDescriptor {
|
|
||||||
val typeSubstitutor = TypeSubstitutor.create(
|
|
||||||
declaredTypeParameters
|
|
||||||
.withIndex()
|
.withIndex()
|
||||||
.associateBy({ it.value.typeConstructor }, { TypeProjectionImpl(types[it.index]) })
|
.associateBy({ it.value.typeConstructor }, { TypeProjectionImpl(types[it.index]) })
|
||||||
)
|
)
|
||||||
return staticScope
|
return substitute(typeSubstitutor)!!
|
||||||
.getContributedFunctions(Name.identifier(name), NoLookupLocation.FROM_BACKEND).single().substitute(typeSubstitutor)!!
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun ClassDescriptor.getProperty(name: String, types: List<KotlinType>): PropertyDescriptor {
|
|
||||||
val typeSubstitutor = TypeSubstitutor.create(
|
|
||||||
declaredTypeParameters
|
|
||||||
.withIndex()
|
|
||||||
.associateBy({ it.value.typeConstructor }, { TypeProjectionImpl(types[it.index]) })
|
|
||||||
)
|
|
||||||
return unsubstitutedMemberScope
|
|
||||||
.getContributedVariables(
|
|
||||||
Name.identifier(name),
|
|
||||||
NoLookupLocation.FROM_BACKEND
|
|
||||||
).single().substitute(typeSubstitutor) as PropertyDescriptor
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
val KotlinType.isFunctionOrKFunctionType: Boolean
|
val KotlinType.isFunctionOrKFunctionType: Boolean
|
||||||
get() {
|
get() {
|
||||||
val kind = constructor.declarationDescriptor?.getFunctionalClassKind()
|
val kind = constructor.declarationDescriptor?.getFunctionalClassKind()
|
||||||
|
|||||||
-151
@@ -1,151 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2000-2018 JetBrains s.r.o. 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.backend.common.descriptors
|
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.*
|
|
||||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
|
||||||
import org.jetbrains.kotlin.descriptors.impl.LazyClassReceiverParameterDescriptor
|
|
||||||
import org.jetbrains.kotlin.descriptors.impl.PackageFragmentDescriptorImpl
|
|
||||||
import org.jetbrains.kotlin.descriptors.impl.TypeParameterDescriptorImpl
|
|
||||||
import org.jetbrains.kotlin.name.FqName
|
|
||||||
import org.jetbrains.kotlin.name.Name
|
|
||||||
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe
|
|
||||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope
|
|
||||||
import org.jetbrains.kotlin.storage.LockBasedStorageManager
|
|
||||||
import org.jetbrains.kotlin.types.*
|
|
||||||
|
|
||||||
open class KnownPackageFragmentDescriptor(moduleDescriptor: ModuleDescriptor, fqName: FqName) :
|
|
||||||
PackageFragmentDescriptorImpl(moduleDescriptor, fqName) {
|
|
||||||
override fun getMemberScope(): MemberScope = MemberScope.Empty
|
|
||||||
}
|
|
||||||
|
|
||||||
open class KnownClassDescriptor(
|
|
||||||
private val name: Name,
|
|
||||||
private val containingDeclaration: DeclarationDescriptor,
|
|
||||||
private val sourceElement: SourceElement,
|
|
||||||
private val kind: ClassKind,
|
|
||||||
private val modality: Modality,
|
|
||||||
private val visibility: Visibility,
|
|
||||||
override val annotations: Annotations
|
|
||||||
) : ClassDescriptor {
|
|
||||||
init {
|
|
||||||
assert(modality != Modality.SEALED) { "Implement getSealedSubclasses() for this class: ${this::class.java}" }
|
|
||||||
}
|
|
||||||
|
|
||||||
private lateinit var typeConstructor: TypeConstructor
|
|
||||||
private lateinit var supertypes: List<KotlinType>
|
|
||||||
private lateinit var defaultType: SimpleType
|
|
||||||
private lateinit var declaredTypeParameters: List<TypeParameterDescriptor>
|
|
||||||
|
|
||||||
private val thisAsReceiverParameter = LazyClassReceiverParameterDescriptor(this)
|
|
||||||
|
|
||||||
fun initialize(declaredTypeParameters: List<TypeParameterDescriptor>, supertypes: List<KotlinType>) {
|
|
||||||
this.declaredTypeParameters = declaredTypeParameters
|
|
||||||
this.supertypes = supertypes
|
|
||||||
this.typeConstructor = ClassTypeConstructorImpl(this, declaredTypeParameters, supertypes, LockBasedStorageManager.NO_LOCKS)
|
|
||||||
this.defaultType = TypeUtils.makeUnsubstitutedType(this, unsubstitutedMemberScope)
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
fun createClass(
|
|
||||||
name: Name,
|
|
||||||
containingDeclaration: DeclarationDescriptor,
|
|
||||||
supertypes: List<KotlinType>,
|
|
||||||
modality: Modality = Modality.FINAL,
|
|
||||||
visibility: Visibility = Visibilities.PUBLIC,
|
|
||||||
annotations: Annotations = Annotations.EMPTY
|
|
||||||
) =
|
|
||||||
KnownClassDescriptor(
|
|
||||||
name, containingDeclaration,
|
|
||||||
SourceElement.NO_SOURCE, ClassKind.CLASS,
|
|
||||||
modality, visibility,
|
|
||||||
annotations
|
|
||||||
).apply {
|
|
||||||
initialize(emptyList(), supertypes)
|
|
||||||
}
|
|
||||||
|
|
||||||
private inline fun createClassWithTypeParameters(
|
|
||||||
name: Name,
|
|
||||||
containingDeclaration: DeclarationDescriptor,
|
|
||||||
supertypes: List<KotlinType>,
|
|
||||||
modality: Modality = Modality.FINAL,
|
|
||||||
visibility: Visibility = Visibilities.PUBLIC,
|
|
||||||
annotations: Annotations = Annotations.EMPTY,
|
|
||||||
createTypeParameters: (ClassDescriptor) -> List<TypeParameterDescriptor>
|
|
||||||
) =
|
|
||||||
KnownClassDescriptor(
|
|
||||||
name, containingDeclaration,
|
|
||||||
SourceElement.NO_SOURCE, ClassKind.CLASS,
|
|
||||||
modality, visibility,
|
|
||||||
annotations
|
|
||||||
).apply {
|
|
||||||
initialize(createTypeParameters(this), supertypes)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun createClassWithTypeParameters(
|
|
||||||
name: Name,
|
|
||||||
containingDeclaration: DeclarationDescriptor,
|
|
||||||
supertypes: List<KotlinType>,
|
|
||||||
typeParameterNames: List<Name>,
|
|
||||||
modality: Modality = Modality.FINAL,
|
|
||||||
visibility: Visibility = Visibilities.PUBLIC,
|
|
||||||
annotations: Annotations = Annotations.EMPTY
|
|
||||||
) =
|
|
||||||
createClassWithTypeParameters(name, containingDeclaration, supertypes, modality, visibility, annotations) { classDescriptor ->
|
|
||||||
typeParameterNames.mapIndexed { index, name ->
|
|
||||||
TypeParameterDescriptorImpl.createWithDefaultBound(
|
|
||||||
classDescriptor, Annotations.EMPTY, true, Variance.INVARIANT, name, index
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getCompanionObjectDescriptor(): ClassDescriptor? = null
|
|
||||||
override fun getConstructors(): Collection<ClassConstructorDescriptor> = emptyList()
|
|
||||||
override fun getContainingDeclaration(): DeclarationDescriptor = containingDeclaration
|
|
||||||
override fun getDeclaredTypeParameters(): List<TypeParameterDescriptor> = declaredTypeParameters
|
|
||||||
override fun getKind(): ClassKind = kind
|
|
||||||
override fun getSealedSubclasses(): Collection<ClassDescriptor> = emptyList()
|
|
||||||
|
|
||||||
override fun getMemberScope(typeArguments: MutableList<out TypeProjection>): MemberScope = MemberScope.Empty
|
|
||||||
override fun getMemberScope(typeSubstitution: TypeSubstitution): MemberScope = MemberScope.Empty
|
|
||||||
override fun getStaticScope(): MemberScope = MemberScope.Empty
|
|
||||||
override fun getUnsubstitutedInnerClassesScope(): MemberScope = MemberScope.Empty
|
|
||||||
override fun getUnsubstitutedMemberScope(): MemberScope = MemberScope.Empty
|
|
||||||
|
|
||||||
override fun getUnsubstitutedPrimaryConstructor(): ClassConstructorDescriptor? = null
|
|
||||||
|
|
||||||
override fun substitute(substitutor: TypeSubstitutor): ClassDescriptor = error("Class $this can't be substituted")
|
|
||||||
|
|
||||||
override fun getThisAsReceiverParameter(): ReceiverParameterDescriptor = thisAsReceiverParameter
|
|
||||||
|
|
||||||
override fun getModality(): Modality = modality
|
|
||||||
override fun getOriginal(): ClassDescriptor = this
|
|
||||||
override fun getName(): Name = name
|
|
||||||
override fun getVisibility(): Visibility = visibility
|
|
||||||
override fun getSource(): SourceElement = sourceElement
|
|
||||||
override fun getTypeConstructor(): TypeConstructor = typeConstructor
|
|
||||||
override fun getDefaultType(): SimpleType = defaultType
|
|
||||||
|
|
||||||
override fun isCompanionObject(): Boolean = false
|
|
||||||
override fun isData(): Boolean = false
|
|
||||||
override fun isInline(): Boolean = false
|
|
||||||
override fun isInner(): Boolean = false
|
|
||||||
override fun isExpect(): Boolean = false
|
|
||||||
override fun isActual(): Boolean = false
|
|
||||||
override fun isExternal(): Boolean = false
|
|
||||||
|
|
||||||
override fun <R : Any?, D : Any?> accept(visitor: DeclarationDescriptorVisitor<R, D>, data: D): R {
|
|
||||||
return visitor.visitClassDescriptor(this, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun acceptVoid(visitor: DeclarationDescriptorVisitor<Void, Void>) {
|
|
||||||
visitor.visitClassDescriptor(this, null)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun toString(): String =
|
|
||||||
"KnownClassDescriptor($fqNameUnsafe)"
|
|
||||||
}
|
|
||||||
-72
@@ -1,72 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2017 JetBrains s.r.o.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.backend.common.descriptors
|
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.*
|
|
||||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
|
||||||
import org.jetbrains.kotlin.name.Name
|
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedCallableMemberDescriptor
|
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedPropertyDescriptor
|
|
||||||
import org.jetbrains.kotlin.types.KotlinType
|
|
||||||
|
|
||||||
fun ClassDescriptor?.getter2Descriptor(methodName: Name) = this?.let {
|
|
||||||
this.unsubstitutedMemberScope.getContributedDescriptors { true }
|
|
||||||
.firstOrNull {
|
|
||||||
it.name == methodName
|
|
||||||
}?.let {
|
|
||||||
return@let (it as? PropertyDescriptor)?.getter
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun ClassDescriptor?.signature2Descriptor(methodName: Name, signature: Array<KotlinType> = emptyArray()) = this?.let {
|
|
||||||
this
|
|
||||||
.unsubstitutedMemberScope
|
|
||||||
.getContributedFunctions(methodName, NoLookupLocation.FROM_BACKEND)
|
|
||||||
.firstOrNull {
|
|
||||||
return@firstOrNull it.valueParameters.size == signature.size
|
|
||||||
&& (signature.isEmpty() || it.valueParameters.any { p ->
|
|
||||||
val index = it.valueParameters.indexOf(p)
|
|
||||||
return@any p.type == signature[index]
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val String.synthesizedName get() = Name.identifier(this.synthesizedString)
|
|
||||||
|
|
||||||
val String.synthesizedString get() = "\$$this"
|
|
||||||
|
|
||||||
val DeclarationDescriptor.propertyIfAccessor
|
|
||||||
get() = if (this is PropertyAccessorDescriptor)
|
|
||||||
this.correspondingProperty
|
|
||||||
else this
|
|
||||||
|
|
||||||
val CallableMemberDescriptor.propertyIfAccessor
|
|
||||||
get() = if (this is PropertyAccessorDescriptor)
|
|
||||||
this.correspondingProperty
|
|
||||||
else this
|
|
||||||
|
|
||||||
val FunctionDescriptor.deserializedPropertyIfAccessor: DeserializedCallableMemberDescriptor
|
|
||||||
get() {
|
|
||||||
val member = this.propertyIfAccessor
|
|
||||||
if (member is DeserializedCallableMemberDescriptor)
|
|
||||||
return member
|
|
||||||
else
|
|
||||||
error("Unexpected deserializable callable descriptor")
|
|
||||||
}
|
|
||||||
|
|
||||||
val CallableMemberDescriptor.isDeserializableCallable
|
|
||||||
get () = (this.propertyIfAccessor is DeserializedCallableMemberDescriptor)
|
|
||||||
@@ -7,7 +7,6 @@ package org.jetbrains.kotlin.ir.backend.js
|
|||||||
|
|
||||||
import org.jetbrains.kotlin.backend.common.CommonBackendContext
|
import org.jetbrains.kotlin.backend.common.CommonBackendContext
|
||||||
import org.jetbrains.kotlin.backend.common.atMostOne
|
import org.jetbrains.kotlin.backend.common.atMostOne
|
||||||
import org.jetbrains.kotlin.backend.common.descriptors.KnownPackageFragmentDescriptor
|
|
||||||
import org.jetbrains.kotlin.backend.common.ir.Ir
|
import org.jetbrains.kotlin.backend.common.ir.Ir
|
||||||
import org.jetbrains.kotlin.backend.common.ir.Symbols
|
import org.jetbrains.kotlin.backend.common.ir.Symbols
|
||||||
import org.jetbrains.kotlin.backend.common.phaser.PhaseConfig
|
import org.jetbrains.kotlin.backend.common.phaser.PhaseConfig
|
||||||
@@ -17,6 +16,7 @@ import org.jetbrains.kotlin.config.CompilerConfiguration
|
|||||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.SimpleFunctionDescriptor
|
import org.jetbrains.kotlin.descriptors.SimpleFunctionDescriptor
|
||||||
|
import org.jetbrains.kotlin.descriptors.impl.EmptyPackageFragmentDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl
|
import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl
|
||||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||||
import org.jetbrains.kotlin.ir.IrElement
|
import org.jetbrains.kotlin.ir.IrElement
|
||||||
@@ -59,7 +59,7 @@ class JsIrBackendContext(
|
|||||||
val packageLevelJsModules = mutableListOf<IrFile>()
|
val packageLevelJsModules = mutableListOf<IrFile>()
|
||||||
val declarationLevelJsModules = mutableListOf<IrDeclaration>()
|
val declarationLevelJsModules = mutableListOf<IrDeclaration>()
|
||||||
|
|
||||||
val internalPackageFragmentDescriptor = KnownPackageFragmentDescriptor(builtIns.builtInsModule, FqName("kotlin.js.internal"))
|
val internalPackageFragmentDescriptor = EmptyPackageFragmentDescriptor(builtIns.builtInsModule, FqName("kotlin.js.internal"))
|
||||||
val implicitDeclarationFile by lazy {
|
val implicitDeclarationFile by lazy {
|
||||||
IrFileImpl(object : SourceManager.FileEntry {
|
IrFileImpl(object : SourceManager.FileEntry {
|
||||||
override val name = "<implicitDeclarations>"
|
override val name = "<implicitDeclarations>"
|
||||||
|
|||||||
-47
@@ -1,47 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2016 JetBrains s.r.o.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.backend.jvm.descriptors
|
|
||||||
|
|
||||||
import org.jetbrains.kotlin.backend.common.descriptors.KnownClassDescriptor
|
|
||||||
import org.jetbrains.kotlin.descriptors.*
|
|
||||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
|
||||||
import org.jetbrains.kotlin.name.Name
|
|
||||||
import org.jetbrains.kotlin.resolve.descriptorUtil.module
|
|
||||||
|
|
||||||
interface DefaultImplsClassDescriptor : ClassDescriptor {
|
|
||||||
val correspondingInterface: ClassDescriptor
|
|
||||||
}
|
|
||||||
|
|
||||||
class DefaultImplsClassDescriptorImpl(
|
|
||||||
name: Name,
|
|
||||||
override val correspondingInterface: ClassDescriptor,
|
|
||||||
sourceElement: SourceElement
|
|
||||||
) : DefaultImplsClassDescriptor, KnownClassDescriptor(
|
|
||||||
name,
|
|
||||||
correspondingInterface,
|
|
||||||
sourceElement,
|
|
||||||
ClassKind.CLASS,
|
|
||||||
Modality.FINAL,
|
|
||||||
Visibilities.PUBLIC,
|
|
||||||
Annotations.EMPTY
|
|
||||||
) {
|
|
||||||
init {
|
|
||||||
initialize(emptyList(), listOf(correspondingInterface.module.builtIns.anyType))
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun isExternal() = false
|
|
||||||
}
|
|
||||||
@@ -127,7 +127,6 @@ class IrBuiltIns(
|
|||||||
|
|
||||||
val collectionClass = builtIns.collection.toIrSymbol()
|
val collectionClass = builtIns.collection.toIrSymbol()
|
||||||
|
|
||||||
val arrayType = builtIns.array.toIrType(symbolTable = symbolTable)
|
|
||||||
val arrayClass = builtIns.array.toIrSymbol()
|
val arrayClass = builtIns.array.toIrSymbol()
|
||||||
|
|
||||||
val throwableType = builtIns.throwable.defaultType.toIrType()
|
val throwableType = builtIns.throwable.defaultType.toIrType()
|
||||||
|
|||||||
@@ -107,11 +107,6 @@ private fun makeKotlinType(
|
|||||||
return classifier.descriptor.defaultType.replace(newArguments = kotlinTypeArguments).makeNullableAsSpecified(hasQuestionMark)
|
return classifier.descriptor.defaultType.replace(newArguments = kotlinTypeArguments).makeNullableAsSpecified(hasQuestionMark)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun ClassifierDescriptor.toIrType(hasQuestionMark: Boolean = false, symbolTable: SymbolTable? = null): IrType {
|
|
||||||
val symbol = getSymbol(symbolTable)
|
|
||||||
return IrSimpleTypeImpl(defaultType, symbol, hasQuestionMark, listOf(), listOf())
|
|
||||||
}
|
|
||||||
|
|
||||||
val IrTypeParameter.defaultType: IrType
|
val IrTypeParameter.defaultType: IrType
|
||||||
get() = IrSimpleTypeImpl(
|
get() = IrSimpleTypeImpl(
|
||||||
symbol,
|
symbol,
|
||||||
@@ -155,4 +150,4 @@ private fun ClassifierDescriptor.getSymbol(symbolTable: SymbolTable?): IrClassif
|
|||||||
is ClassDescriptor -> symbolTable?.referenceClass(this) ?: IrClassSymbolImpl(this)
|
is ClassDescriptor -> symbolTable?.referenceClass(this) ?: IrClassSymbolImpl(this)
|
||||||
is TypeParameterDescriptor -> symbolTable?.referenceTypeParameter(this) ?: IrTypeParameterSymbolImpl(this)
|
is TypeParameterDescriptor -> symbolTable?.referenceTypeParameter(this) ?: IrTypeParameterSymbolImpl(this)
|
||||||
else -> TODO()
|
else -> TODO()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user