Move util functions from KotlinBuiltIns to :core:descriptors.common module
This commit is contained in:
@@ -24,7 +24,7 @@ import java.util.*
|
||||
|
||||
object CompanionObjectMapping {
|
||||
private val classIds =
|
||||
(PrimitiveType.NUMBER_TYPES.map(KotlinBuiltIns::getPrimitiveFqName) +
|
||||
(PrimitiveType.NUMBER_TYPES.map(KotlinBuiltInsNames::getPrimitiveFqName) +
|
||||
KotlinBuiltInsNames.FqNames.string.toSafe() +
|
||||
KotlinBuiltInsNames.FqNames._boolean.toSafe() +
|
||||
KotlinBuiltInsNames.FqNames._enum.toSafe()).mapTo(linkedSetOf<ClassId>(), ClassId::topLevel)
|
||||
|
||||
@@ -288,36 +288,11 @@ public abstract class KotlinBuiltIns {
|
||||
return getBuiltInClassByName("Unit");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String getFunctionName(int parameterCount) {
|
||||
return "Function" + parameterCount;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static FqNameUnsafe getKFunctionFqName(int parameterCount) {
|
||||
return FqNames.reflect(FunctionClassKind.KFunction.getClassNamePrefix() + parameterCount);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static ClassId getFunctionClassId(int parameterCount) {
|
||||
return new ClassId(BUILT_INS_PACKAGE_FQ_NAME, Name.identifier(getFunctionName(parameterCount)));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ClassDescriptor getFunction(int parameterCount) {
|
||||
return getBuiltInClassByName(getFunctionName(parameterCount));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String getSuspendFunctionName(int parameterCount) {
|
||||
return FunctionClassKind.SuspendFunction.getClassNamePrefix() + parameterCount;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static ClassId getSuspendFunctionClassId(int parameterCount) {
|
||||
return new ClassId(COROUTINES_PACKAGE_FQ_NAME_RELEASE, Name.identifier(getSuspendFunctionName(parameterCount)));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ClassDescriptor getSuspendFunction(int parameterCount) {
|
||||
return getBuiltInClassByFqName(COROUTINES_PACKAGE_FQ_NAME_RELEASE.child(Name.identifier(getSuspendFunctionName(parameterCount))));
|
||||
@@ -663,10 +638,6 @@ public abstract class KotlinBuiltIns {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean isPrimitiveArray(@NotNull FqNameUnsafe arrayFqName) {
|
||||
return FqNames.arrayClassFqNameToPrimitiveType.get(arrayFqName) != null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static PrimitiveType getPrimitiveType(@NotNull DeclarationDescriptor descriptor) {
|
||||
return FqNames.primitiveTypeShortNames.contains(descriptor.getName())
|
||||
@@ -985,8 +956,4 @@ public abstract class KotlinBuiltIns {
|
||||
public static boolean isNotNullOrNullableFunctionSupertype(@NotNull KotlinType type) {
|
||||
return isConstructedFromGivenClass(type, FqNames.functionSupertype);
|
||||
}
|
||||
|
||||
public static FqName getPrimitiveFqName(@NotNull PrimitiveType primitiveType) {
|
||||
return BUILT_INS_PACKAGE_FQ_NAME.child(primitiveType.getTypeName());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user