Load additional built-in classes constructors from JDK
#KT-9194 In Progress #KT-5175 In Progress #KT-10370 In Progress #KT-7127 In Progress
This commit is contained in:
+3
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.serialization.deserialization
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.ConstructorDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.SimpleFunctionDescriptor
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedClassDescriptor
|
||||
@@ -24,11 +25,13 @@ import org.jetbrains.kotlin.types.KotlinType
|
||||
interface AdditionalClassPartsProvider {
|
||||
fun getSupertypes(classDescriptor: DeserializedClassDescriptor): Collection<KotlinType>
|
||||
fun getFunctions(name: Name, classDescriptor: DeserializedClassDescriptor): Collection<SimpleFunctionDescriptor>
|
||||
fun getConstructors(classDescriptor: DeserializedClassDescriptor): Collection<ConstructorDescriptor>
|
||||
fun getFunctionsNames(classDescriptor: DeserializedClassDescriptor): Collection<Name>
|
||||
|
||||
object None : AdditionalClassPartsProvider {
|
||||
override fun getSupertypes(classDescriptor: DeserializedClassDescriptor): Collection<KotlinType> = emptyList()
|
||||
override fun getFunctions(name: Name, classDescriptor: DeserializedClassDescriptor): Collection<SimpleFunctionDescriptor> = emptyList()
|
||||
override fun getFunctionsNames(classDescriptor: DeserializedClassDescriptor): Collection<Name> = emptyList()
|
||||
override fun getConstructors(classDescriptor: DeserializedClassDescriptor): Collection<ConstructorDescriptor> = emptyList()
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -116,7 +116,8 @@ class DeserializedClassDescriptor(
|
||||
override fun getUnsubstitutedPrimaryConstructor(): ConstructorDescriptor? = primaryConstructor()
|
||||
|
||||
private fun computeConstructors(): Collection<ConstructorDescriptor> =
|
||||
computeSecondaryConstructors() + getUnsubstitutedPrimaryConstructor().singletonOrEmptyList()
|
||||
computeSecondaryConstructors() + unsubstitutedPrimaryConstructor.singletonOrEmptyList() +
|
||||
c.components.additionalClassPartsProvider.getConstructors(this)
|
||||
|
||||
private fun computeSecondaryConstructors(): List<ConstructorDescriptor> =
|
||||
classProto.constructorList.filter { Flags.IS_SECONDARY.get(it.flags) }.map {
|
||||
|
||||
Reference in New Issue
Block a user