Minor. Rename FunctionClassDescriptor#functionKind -> functionTypeKind
This commit is needed for the following commit. There we will restore the compatibility API with Android IDEA plugin
This commit is contained in:
committed by
Space Team
parent
a14f3c8cc2
commit
bec9ad0f6b
+8
-8
@@ -52,10 +52,10 @@ internal class KtFe10FunctionalType(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override val isSuspend: Boolean
|
override val isSuspend: Boolean
|
||||||
get() = withValidityAssertion { descriptor.functionKind.isSuspendOrKSuspendFunction }
|
get() = withValidityAssertion { descriptor.functionTypeKind.isSuspendOrKSuspendFunction }
|
||||||
|
|
||||||
override val isReflectType: Boolean
|
override val isReflectType: Boolean
|
||||||
get() = withValidityAssertion { descriptor.functionKind.isReflectType }
|
get() = withValidityAssertion { descriptor.functionTypeKind.isReflectType }
|
||||||
|
|
||||||
override val arity: Int
|
override val arity: Int
|
||||||
get() = withValidityAssertion { descriptor.arity }
|
get() = withValidityAssertion { descriptor.arity }
|
||||||
@@ -78,20 +78,20 @@ internal class KtFe10FunctionalType(
|
|||||||
|
|
||||||
override val hasReceiver: Boolean
|
override val hasReceiver: Boolean
|
||||||
get() = withValidityAssertion {
|
get() = withValidityAssertion {
|
||||||
if (descriptor.functionKind.isReflectType) false
|
if (descriptor.functionTypeKind.isReflectType) false
|
||||||
else fe10Type.getReceiverTypeFromFunctionType() != null
|
else fe10Type.getReceiverTypeFromFunctionType() != null
|
||||||
}
|
}
|
||||||
|
|
||||||
override val receiverType: KtType?
|
override val receiverType: KtType?
|
||||||
get() = withValidityAssertion {
|
get() = withValidityAssertion {
|
||||||
if (descriptor.functionKind.isReflectType) null
|
if (descriptor.functionTypeKind.isReflectType) null
|
||||||
else fe10Type.getReceiverTypeFromFunctionType()?.toKtType(analysisContext)
|
else fe10Type.getReceiverTypeFromFunctionType()?.toKtType(analysisContext)
|
||||||
}
|
}
|
||||||
|
|
||||||
override val parameterTypes: List<KtType>
|
override val parameterTypes: List<KtType>
|
||||||
get() = withValidityAssertion {
|
get() = withValidityAssertion {
|
||||||
when {
|
when {
|
||||||
descriptor.functionKind.isReflectType -> fe10Type.arguments.dropLast(1)
|
descriptor.functionTypeKind.isReflectType -> fe10Type.arguments.dropLast(1)
|
||||||
else -> fe10Type.getValueParameterTypesFromFunctionType()
|
else -> fe10Type.getValueParameterTypesFromFunctionType()
|
||||||
}.map { it.type.toKtType(analysisContext) }
|
}.map { it.type.toKtType(analysisContext) }
|
||||||
}
|
}
|
||||||
@@ -99,7 +99,7 @@ internal class KtFe10FunctionalType(
|
|||||||
override val returnType: KtType
|
override val returnType: KtType
|
||||||
get() = withValidityAssertion {
|
get() = withValidityAssertion {
|
||||||
when {
|
when {
|
||||||
descriptor.functionKind.isReflectType -> fe10Type.arguments.last().type
|
descriptor.functionTypeKind.isReflectType -> fe10Type.arguments.last().type
|
||||||
else -> fe10Type.getReturnTypeFromFunctionType()
|
else -> fe10Type.getReturnTypeFromFunctionType()
|
||||||
}.toKtType(analysisContext)
|
}.toKtType(analysisContext)
|
||||||
}
|
}
|
||||||
@@ -107,8 +107,8 @@ internal class KtFe10FunctionalType(
|
|||||||
override val classId: ClassId
|
override val classId: ClassId
|
||||||
get() = withValidityAssertion {
|
get() = withValidityAssertion {
|
||||||
ClassId(
|
ClassId(
|
||||||
descriptor.functionKind.packageFqName,
|
descriptor.functionTypeKind.packageFqName,
|
||||||
descriptor.functionKind.numberedClassName(descriptor.arity)
|
descriptor.functionTypeKind.numberedClassName(descriptor.arity)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -61,7 +61,7 @@ internal class KtFe10TypeSystemCommonBackendContextForTypeMapping(
|
|||||||
override fun SimpleTypeMarker.isSuspendFunction(): Boolean {
|
override fun SimpleTypeMarker.isSuspendFunction(): Boolean {
|
||||||
require(this is SimpleType)
|
require(this is SimpleType)
|
||||||
val declaration = constructor.declarationDescriptor
|
val declaration = constructor.declarationDescriptor
|
||||||
return declaration is FunctionClassDescriptor && declaration.functionKind.isSuspendOrKSuspendFunction
|
return declaration is FunctionClassDescriptor && declaration.functionTypeKind.isSuspendOrKSuspendFunction
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun SimpleTypeMarker.isKClass(): Boolean {
|
override fun SimpleTypeMarker.isKClass(): Boolean {
|
||||||
|
|||||||
@@ -342,8 +342,8 @@ class KotlinTypeMapper @JvmOverloads constructor(
|
|||||||
|
|
||||||
if (classDescriptor is FunctionClassDescriptor) {
|
if (classDescriptor is FunctionClassDescriptor) {
|
||||||
if (classDescriptor.hasBigArity ||
|
if (classDescriptor.hasBigArity ||
|
||||||
classDescriptor.functionKind == FunctionTypeKind.KFunction ||
|
classDescriptor.functionTypeKind == FunctionTypeKind.KFunction ||
|
||||||
classDescriptor.functionKind == FunctionTypeKind.KSuspendFunction
|
classDescriptor.functionTypeKind == FunctionTypeKind.KSuspendFunction
|
||||||
) {
|
) {
|
||||||
// kotlin.reflect.KFunction{n}<P1, ..., Pn, R> is mapped to kotlin.reflect.KFunction<R> (for all n), and
|
// kotlin.reflect.KFunction{n}<P1, ..., Pn, R> is mapped to kotlin.reflect.KFunction<R> (for all n), and
|
||||||
// kotlin.Function{n}<P1, ..., Pn, R> is mapped to kotlin.jvm.functions.FunctionN<R> (for n > 22).
|
// kotlin.Function{n}<P1, ..., Pn, R> is mapped to kotlin.jvm.functions.FunctionN<R> (for n > 22).
|
||||||
|
|||||||
+4
-4
@@ -22,14 +22,14 @@ object SuspendFunctionAsSupertypeChecker : DeclarationChecker {
|
|||||||
val functionalSupertypes = descriptor.getAllSuperClassifiers().filterIsInstance<FunctionClassDescriptor>().toList()
|
val functionalSupertypes = descriptor.getAllSuperClassifiers().filterIsInstance<FunctionClassDescriptor>().toList()
|
||||||
|
|
||||||
if (functionalSupertypes.none {
|
if (functionalSupertypes.none {
|
||||||
it.functionKind == FunctionTypeKind.SuspendFunction ||
|
it.functionTypeKind == FunctionTypeKind.SuspendFunction ||
|
||||||
it.functionKind == FunctionTypeKind.KSuspendFunction
|
it.functionTypeKind == FunctionTypeKind.KSuspendFunction
|
||||||
}
|
}
|
||||||
) return
|
) return
|
||||||
|
|
||||||
if (functionalSupertypes.any {
|
if (functionalSupertypes.any {
|
||||||
it.functionKind == FunctionTypeKind.Function ||
|
it.functionTypeKind == FunctionTypeKind.Function ||
|
||||||
it.functionKind == FunctionTypeKind.KFunction
|
it.functionTypeKind == FunctionTypeKind.KFunction
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
val reportOn = (declaration as? KtClassOrObject)?.getSuperTypeList() ?: declaration
|
val reportOn = (declaration as? KtClassOrObject)?.getSuperTypeList() ?: declaration
|
||||||
|
|||||||
+3
-3
@@ -31,9 +31,9 @@ import org.jetbrains.kotlin.utils.addToStdlib.shouldNotBeCalled
|
|||||||
class FunctionClassDescriptor(
|
class FunctionClassDescriptor(
|
||||||
private val storageManager: StorageManager,
|
private val storageManager: StorageManager,
|
||||||
private val containingDeclaration: PackageFragmentDescriptor,
|
private val containingDeclaration: PackageFragmentDescriptor,
|
||||||
val functionKind: FunctionTypeKind,
|
val functionTypeKind: FunctionTypeKind,
|
||||||
val arity: Int
|
val arity: Int
|
||||||
) : AbstractClassDescriptor(storageManager, functionKind.numberedClassName(arity)) {
|
) : AbstractClassDescriptor(storageManager, functionTypeKind.numberedClassName(arity)) {
|
||||||
|
|
||||||
private val typeConstructor = FunctionTypeConstructor()
|
private val typeConstructor = FunctionTypeConstructor()
|
||||||
private val memberScope = FunctionClassScope(storageManager, this)
|
private val memberScope = FunctionClassScope(storageManager, this)
|
||||||
@@ -95,7 +95,7 @@ class FunctionClassDescriptor(
|
|||||||
private inner class FunctionTypeConstructor : AbstractClassTypeConstructor(storageManager) {
|
private inner class FunctionTypeConstructor : AbstractClassTypeConstructor(storageManager) {
|
||||||
override fun computeSupertypes(): Collection<KotlinType> {
|
override fun computeSupertypes(): Collection<KotlinType> {
|
||||||
// For K{Suspend}Function{n}, add corresponding numbered {Suspend}Function{n} class, e.g. {Suspend}Function2 for K{Suspend}Function2
|
// For K{Suspend}Function{n}, add corresponding numbered {Suspend}Function{n} class, e.g. {Suspend}Function2 for K{Suspend}Function2
|
||||||
val supertypes = when (functionKind) {
|
val supertypes = when (functionTypeKind) {
|
||||||
FunctionTypeKind.Function -> // Function$N <: Function
|
FunctionTypeKind.Function -> // Function$N <: Function
|
||||||
listOf(functionClassId)
|
listOf(functionClassId)
|
||||||
FunctionTypeKind.KFunction -> // KFunction$N <: KFunction
|
FunctionTypeKind.KFunction -> // KFunction$N <: KFunction
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class FunctionClassScope(
|
|||||||
containingClass: FunctionClassDescriptor
|
containingClass: FunctionClassDescriptor
|
||||||
) : GivenFunctionsMemberScope(storageManager, containingClass) {
|
) : GivenFunctionsMemberScope(storageManager, containingClass) {
|
||||||
override fun computeDeclaredFunctions(): List<FunctionDescriptor> =
|
override fun computeDeclaredFunctions(): List<FunctionDescriptor> =
|
||||||
when ((containingClass as FunctionClassDescriptor).functionKind) {
|
when ((containingClass as FunctionClassDescriptor).functionTypeKind) {
|
||||||
FunctionTypeKind.Function -> listOf(FunctionInvokeDescriptor.create(containingClass, isSuspend = false))
|
FunctionTypeKind.Function -> listOf(FunctionInvokeDescriptor.create(containingClass, isSuspend = false))
|
||||||
FunctionTypeKind.SuspendFunction -> listOf(FunctionInvokeDescriptor.create(containingClass, isSuspend = true))
|
FunctionTypeKind.SuspendFunction -> listOf(FunctionInvokeDescriptor.create(containingClass, isSuspend = true))
|
||||||
else -> emptyList()
|
else -> emptyList()
|
||||||
|
|||||||
+1
-1
@@ -338,7 +338,7 @@ public final class ExpressionVisitor extends TranslatorVisitor<JsNode> {
|
|||||||
default: {
|
default: {
|
||||||
if (descriptor instanceof FunctionClassDescriptor) {
|
if (descriptor instanceof FunctionClassDescriptor) {
|
||||||
FunctionClassDescriptor functionClassDescriptor = (FunctionClassDescriptor) descriptor;
|
FunctionClassDescriptor functionClassDescriptor = (FunctionClassDescriptor) descriptor;
|
||||||
if (functionClassDescriptor.getFunctionKind() == FunctionTypeKind.Function.INSTANCE) {
|
if (functionClassDescriptor.getFunctionTypeKind() == FunctionTypeKind.Function.INSTANCE) {
|
||||||
ClassDescriptor primitivesObject = findPrimitiveClassesObject(context);
|
ClassDescriptor primitivesObject = findPrimitiveClassesObject(context);
|
||||||
assert primitivesObject != null;
|
assert primitivesObject != null;
|
||||||
FunctionDescriptor function = DescriptorUtils.getFunctionByName(
|
FunctionDescriptor function = DescriptorUtils.getFunctionByName(
|
||||||
|
|||||||
+1
-1
@@ -168,7 +168,7 @@ internal class BuiltInFictitiousFunctionIrClassFactory(
|
|||||||
|
|
||||||
val builtFunctionNClasses get() = builtClassesMap.entries.mapNotNull { (descriptor, irClass) ->
|
val builtFunctionNClasses get() = builtClassesMap.entries.mapNotNull { (descriptor, irClass) ->
|
||||||
with(descriptor) {
|
with(descriptor) {
|
||||||
if (functionKind == FunctionTypeKind.Function)
|
if (functionTypeKind == FunctionTypeKind.Function)
|
||||||
FunctionalInterface(irClass, descriptor, arity)
|
FunctionalInterface(irClass, descriptor, arity)
|
||||||
else null
|
else null
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user