Rename KotlinBuiltInsNames to StandardNames
This commit is contained in:
@@ -8,7 +8,7 @@ package org.jetbrains.kotlin.backend.common.ir
|
||||
import org.jetbrains.kotlin.backend.common.CommonBackendContext
|
||||
import org.jetbrains.kotlin.backend.common.lower.LocalDeclarationsLowering
|
||||
import org.jetbrains.kotlin.builtins.*
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames.KOTLIN_REFLECT_FQ_NAME
|
||||
import org.jetbrains.kotlin.builtins.StandardNames.KOTLIN_REFLECT_FQ_NAME
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.SimpleFunctionDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.findClassAcrossModuleDependencies
|
||||
@@ -318,7 +318,7 @@ abstract class Symbols<out T : CommonBackendContext>(val context: T, irBuiltIns:
|
||||
function.getPackageFragment()!!.fqName.asString() == "kotlin" &&
|
||||
function.valueParameters.isEmpty() &&
|
||||
symbol.owner.extensionReceiverParameter?.type?.classOrNull?.owner.let { receiverClass ->
|
||||
receiverClass?.fqNameWhenAvailable?.toUnsafe() == KotlinBuiltInsNames.FqNames.kProperty0
|
||||
receiverClass?.fqNameWhenAvailable?.toUnsafe() == StandardNames.FqNames.kProperty0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -8,7 +8,7 @@ package org.jetbrains.kotlin.backend.common.lower
|
||||
import org.jetbrains.kotlin.backend.common.CommonBackendContext
|
||||
import org.jetbrains.kotlin.backend.common.FileLoweringPass
|
||||
import org.jetbrains.kotlin.backend.common.phaser.makeIrFilePhase
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames
|
||||
import org.jetbrains.kotlin.builtins.StandardNames
|
||||
import org.jetbrains.kotlin.ir.IrElement
|
||||
import org.jetbrains.kotlin.ir.declarations.IrFile
|
||||
import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction
|
||||
@@ -72,8 +72,8 @@ class FlattenStringConcatenationLowering(val context: CommonBackendContext) : Fi
|
||||
// The version for nullable strings has FqName kotlin.plus, the version for non-nullable strings
|
||||
// is a member function of kotlin.String (with FqName kotlin.String.plus)
|
||||
private val PARENT_NAMES = setOf(
|
||||
KotlinBuiltInsNames.BUILT_INS_PACKAGE_FQ_NAME,
|
||||
KotlinBuiltInsNames.FqNames.string.toSafe()
|
||||
StandardNames.BUILT_INS_PACKAGE_FQ_NAME,
|
||||
StandardNames.FqNames.string.toSafe()
|
||||
)
|
||||
|
||||
/** @return true if the given expression is a call to [String.plus] */
|
||||
@@ -108,7 +108,7 @@ class FlattenStringConcatenationLowering(val context: CommonBackendContext) : Fi
|
||||
|
||||
return dispatchReceiverParameter == null
|
||||
&& extensionReceiverParameter?.type?.isNullableAny() == true
|
||||
&& fqNameWhenAvailable?.parent() == KotlinBuiltInsNames.BUILT_INS_PACKAGE_FQ_NAME
|
||||
&& fqNameWhenAvailable?.parent() == StandardNames.BUILT_INS_PACKAGE_FQ_NAME
|
||||
}
|
||||
|
||||
/** @return true if the given expression is a call to [toString] */
|
||||
|
||||
+25
-25
@@ -7,7 +7,7 @@ package org.jetbrains.kotlin.backend.common.lower
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.CommonBackendContext
|
||||
import org.jetbrains.kotlin.backend.common.ir.allOverridden
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames
|
||||
import org.jetbrains.kotlin.builtins.StandardNames
|
||||
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
||||
import org.jetbrains.kotlin.ir.declarations.IrClass
|
||||
import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction
|
||||
@@ -63,46 +63,46 @@ class SpecialBridgeMethods(val context: CommonBackendContext) {
|
||||
IrGetValueImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, bridge.valueParameters[1].symbol)
|
||||
|
||||
private val specialMethodsWithDefaults = mapOf(
|
||||
makeDescription(KotlinBuiltInsNames.FqNames.collection, "contains", 1) to
|
||||
makeDescription(StandardNames.FqNames.collection, "contains", 1) to
|
||||
SpecialMethodWithDefaultInfo(::constFalse, 1),
|
||||
makeDescription(KotlinBuiltInsNames.FqNames.mutableCollection, "remove", 1) to
|
||||
makeDescription(StandardNames.FqNames.mutableCollection, "remove", 1) to
|
||||
SpecialMethodWithDefaultInfo(::constFalse, 1, needsArgumentBoxing = true),
|
||||
makeDescription(KotlinBuiltInsNames.FqNames.map, "containsKey", 1) to
|
||||
makeDescription(StandardNames.FqNames.map, "containsKey", 1) to
|
||||
SpecialMethodWithDefaultInfo(::constFalse, 1),
|
||||
makeDescription(KotlinBuiltInsNames.FqNames.map, "containsValue", 1) to
|
||||
makeDescription(StandardNames.FqNames.map, "containsValue", 1) to
|
||||
SpecialMethodWithDefaultInfo(::constFalse, 1),
|
||||
makeDescription(KotlinBuiltInsNames.FqNames.mutableMap, "remove", 2) to
|
||||
makeDescription(StandardNames.FqNames.mutableMap, "remove", 2) to
|
||||
SpecialMethodWithDefaultInfo(::constFalse, 2),
|
||||
makeDescription(KotlinBuiltInsNames.FqNames.list, "indexOf", 1) to
|
||||
makeDescription(StandardNames.FqNames.list, "indexOf", 1) to
|
||||
SpecialMethodWithDefaultInfo(::constMinusOne, 1),
|
||||
makeDescription(KotlinBuiltInsNames.FqNames.list, "lastIndexOf", 1) to
|
||||
makeDescription(StandardNames.FqNames.list, "lastIndexOf", 1) to
|
||||
SpecialMethodWithDefaultInfo(::constMinusOne, 1),
|
||||
makeDescription(KotlinBuiltInsNames.FqNames.map, "getOrDefault", 2) to
|
||||
makeDescription(StandardNames.FqNames.map, "getOrDefault", 2) to
|
||||
SpecialMethodWithDefaultInfo(::getSecondArg, 1, needsGenericSignature = true),
|
||||
makeDescription(KotlinBuiltInsNames.FqNames.map, "get", 1) to
|
||||
makeDescription(StandardNames.FqNames.map, "get", 1) to
|
||||
SpecialMethodWithDefaultInfo(::constNull, 1, needsGenericSignature = true),
|
||||
makeDescription(KotlinBuiltInsNames.FqNames.mutableMap, "remove", 1) to
|
||||
makeDescription(StandardNames.FqNames.mutableMap, "remove", 1) to
|
||||
SpecialMethodWithDefaultInfo(::constNull, 1, needsGenericSignature = true)
|
||||
)
|
||||
|
||||
private val specialProperties = mapOf(
|
||||
makeDescription(KotlinBuiltInsNames.FqNames.collection, "size") to BuiltInWithDifferentJvmName(),
|
||||
makeDescription(KotlinBuiltInsNames.FqNames.map, "size") to BuiltInWithDifferentJvmName(),
|
||||
makeDescription(KotlinBuiltInsNames.FqNames.charSequence.toSafe(), "length") to BuiltInWithDifferentJvmName(),
|
||||
makeDescription(KotlinBuiltInsNames.FqNames.map, "keys") to BuiltInWithDifferentJvmName(needsGenericSignature = true),
|
||||
makeDescription(KotlinBuiltInsNames.FqNames.map, "values") to BuiltInWithDifferentJvmName(needsGenericSignature = true),
|
||||
makeDescription(KotlinBuiltInsNames.FqNames.map, "entries") to BuiltInWithDifferentJvmName(needsGenericSignature = true)
|
||||
makeDescription(StandardNames.FqNames.collection, "size") to BuiltInWithDifferentJvmName(),
|
||||
makeDescription(StandardNames.FqNames.map, "size") to BuiltInWithDifferentJvmName(),
|
||||
makeDescription(StandardNames.FqNames.charSequence.toSafe(), "length") to BuiltInWithDifferentJvmName(),
|
||||
makeDescription(StandardNames.FqNames.map, "keys") to BuiltInWithDifferentJvmName(needsGenericSignature = true),
|
||||
makeDescription(StandardNames.FqNames.map, "values") to BuiltInWithDifferentJvmName(needsGenericSignature = true),
|
||||
makeDescription(StandardNames.FqNames.map, "entries") to BuiltInWithDifferentJvmName(needsGenericSignature = true)
|
||||
)
|
||||
|
||||
private val specialMethods = mapOf(
|
||||
makeDescription(KotlinBuiltInsNames.FqNames.number.toSafe(), "toByte") to BuiltInWithDifferentJvmName(),
|
||||
makeDescription(KotlinBuiltInsNames.FqNames.number.toSafe(), "toShort") to BuiltInWithDifferentJvmName(),
|
||||
makeDescription(KotlinBuiltInsNames.FqNames.number.toSafe(), "toInt") to BuiltInWithDifferentJvmName(),
|
||||
makeDescription(KotlinBuiltInsNames.FqNames.number.toSafe(), "toLong") to BuiltInWithDifferentJvmName(),
|
||||
makeDescription(KotlinBuiltInsNames.FqNames.number.toSafe(), "toFloat") to BuiltInWithDifferentJvmName(),
|
||||
makeDescription(KotlinBuiltInsNames.FqNames.number.toSafe(), "toDouble") to BuiltInWithDifferentJvmName(),
|
||||
makeDescription(KotlinBuiltInsNames.FqNames.charSequence.toSafe(), "get", 1) to BuiltInWithDifferentJvmName(),
|
||||
makeDescription(KotlinBuiltInsNames.FqNames.mutableList, "removeAt", 1) to BuiltInWithDifferentJvmName(needsGenericSignature = true)
|
||||
makeDescription(StandardNames.FqNames.number.toSafe(), "toByte") to BuiltInWithDifferentJvmName(),
|
||||
makeDescription(StandardNames.FqNames.number.toSafe(), "toShort") to BuiltInWithDifferentJvmName(),
|
||||
makeDescription(StandardNames.FqNames.number.toSafe(), "toInt") to BuiltInWithDifferentJvmName(),
|
||||
makeDescription(StandardNames.FqNames.number.toSafe(), "toLong") to BuiltInWithDifferentJvmName(),
|
||||
makeDescription(StandardNames.FqNames.number.toSafe(), "toFloat") to BuiltInWithDifferentJvmName(),
|
||||
makeDescription(StandardNames.FqNames.number.toSafe(), "toDouble") to BuiltInWithDifferentJvmName(),
|
||||
makeDescription(StandardNames.FqNames.charSequence.toSafe(), "get", 1) to BuiltInWithDifferentJvmName(),
|
||||
makeDescription(StandardNames.FqNames.mutableList, "removeAt", 1) to BuiltInWithDifferentJvmName(needsGenericSignature = true)
|
||||
)
|
||||
|
||||
val specialMethodNames = (specialMethodsWithDefaults + specialMethods).map { (description) -> description.name }.toHashSet()
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.ir.util
|
||||
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames.FqNames
|
||||
import org.jetbrains.kotlin.builtins.StandardNames.FqNames
|
||||
import org.jetbrains.kotlin.builtins.UnsignedTypes
|
||||
import org.jetbrains.kotlin.descriptors.ClassKind
|
||||
import org.jetbrains.kotlin.ir.declarations.IrClass
|
||||
|
||||
+3
-3
@@ -7,7 +7,7 @@ package org.jetbrains.kotlin.backend.jvm
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.ir.createImplicitParameterDeclarationWithWrappedDescriptor
|
||||
import org.jetbrains.kotlin.backend.common.ir.createParameterDeclarations
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames
|
||||
import org.jetbrains.kotlin.builtins.StandardNames
|
||||
import org.jetbrains.kotlin.codegen.SamType
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.annotations.FilteredAnnotations
|
||||
@@ -106,7 +106,7 @@ class JvmGeneratorExtensions(private val generateFacades: Boolean = true) : Gene
|
||||
descriptor.getParentJavaStaticClassScope()
|
||||
|
||||
private val annotationPackage =
|
||||
IrExternalPackageFragmentImpl(DescriptorlessExternalPackageFragmentSymbol(), KotlinBuiltInsNames.ANNOTATION_PACKAGE_FQ_NAME)
|
||||
IrExternalPackageFragmentImpl(DescriptorlessExternalPackageFragmentSymbol(), StandardNames.ANNOTATION_PACKAGE_FQ_NAME)
|
||||
|
||||
private val flexibleNullabilityAnnotationClass = IrFactoryImpl.buildClass {
|
||||
kind = ClassKind.ANNOTATION_CLASS
|
||||
@@ -123,6 +123,6 @@ class JvmGeneratorExtensions(private val generateFacades: Boolean = true) : Gene
|
||||
|
||||
companion object {
|
||||
val FLEXIBLE_NULLABILITY_ANNOTATION_FQ_NAME =
|
||||
KotlinBuiltInsNames.ANNOTATION_PACKAGE_FQ_NAME.child(Name.identifier("FlexibleNullability"))
|
||||
StandardNames.ANNOTATION_PACKAGE_FQ_NAME.child(Name.identifier("FlexibleNullability"))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ package org.jetbrains.kotlin.backend.jvm
|
||||
import org.jetbrains.kotlin.backend.common.ir.Symbols
|
||||
import org.jetbrains.kotlin.backend.common.ir.createImplicitParameterDeclarationWithWrappedDescriptor
|
||||
import org.jetbrains.kotlin.backend.jvm.intrinsics.IrIntrinsicMethods
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames
|
||||
import org.jetbrains.kotlin.builtins.StandardNames
|
||||
import org.jetbrains.kotlin.codegen.coroutines.INVOKE_SUSPEND_METHOD_NAME
|
||||
import org.jetbrains.kotlin.codegen.coroutines.SUSPEND_CALL_RESULT_NAME
|
||||
import org.jetbrains.kotlin.codegen.coroutines.SUSPEND_FUNCTION_COMPLETION_PARAMETER_NAME
|
||||
@@ -200,7 +200,7 @@ class JvmSymbols(
|
||||
get() = TODO("not implemented")
|
||||
|
||||
private val kDeclarationContainer: IrClassSymbol =
|
||||
createClass(KotlinBuiltInsNames.FqNames.kDeclarationContainer.toSafe(), ClassKind.INTERFACE, Modality.ABSTRACT)
|
||||
createClass(StandardNames.FqNames.kDeclarationContainer.toSafe(), ClassKind.INTERFACE, Modality.ABSTRACT)
|
||||
|
||||
val javaLangClass: IrClassSymbol =
|
||||
createClass(FqName("java.lang.Class")) { klass ->
|
||||
@@ -225,12 +225,12 @@ class JvmSymbols(
|
||||
val assertionErrorConstructor = javaLangAssertionError.constructors.single()
|
||||
|
||||
val continuationClass: IrClassSymbol =
|
||||
createClass(KotlinBuiltInsNames.CONTINUATION_INTERFACE_FQ_NAME_RELEASE, ClassKind.INTERFACE) { klass ->
|
||||
createClass(StandardNames.CONTINUATION_INTERFACE_FQ_NAME_RELEASE, ClassKind.INTERFACE) { klass ->
|
||||
klass.addTypeParameter("T", irBuiltIns.anyNType, Variance.IN_VARIANCE)
|
||||
}
|
||||
|
||||
private val resultClassStub: IrClassSymbol =
|
||||
createClass(KotlinBuiltInsNames.RESULT_FQ_NAME, classIsInline = true) { klass ->
|
||||
createClass(StandardNames.RESULT_FQ_NAME, classIsInline = true) { klass ->
|
||||
klass.addTypeParameter("T", irBuiltIns.anyNType, Variance.OUT_VARIANCE)
|
||||
klass.addConstructor { isPrimary = true }.apply {
|
||||
addValueParameter("value", irBuiltIns.anyNType)
|
||||
|
||||
+3
-3
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.backend.common.ir.ir2string
|
||||
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
|
||||
import org.jetbrains.kotlin.backend.jvm.JvmGeneratorExtensions
|
||||
import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames
|
||||
import org.jetbrains.kotlin.builtins.StandardNames
|
||||
import org.jetbrains.kotlin.codegen.AsmUtil
|
||||
import org.jetbrains.kotlin.codegen.TypeAnnotationCollector
|
||||
import org.jetbrains.kotlin.codegen.TypePathInfo
|
||||
@@ -373,7 +373,7 @@ private val RETENTION_PARAMETER_NAME = Name.identifier("value")
|
||||
|
||||
private fun IrClass.getAnnotationRetention(): KotlinRetention? {
|
||||
val retentionArgument =
|
||||
getAnnotation(KotlinBuiltInsNames.FqNames.retention)?.getValueArgument(RETENTION_PARAMETER_NAME)
|
||||
getAnnotation(StandardNames.FqNames.retention)?.getValueArgument(RETENTION_PARAMETER_NAME)
|
||||
as? IrGetEnumValue?: return null
|
||||
val retentionArgumentValue = retentionArgument.symbol.owner
|
||||
return KotlinRetention.valueOf(retentionArgumentValue.name.asString())
|
||||
@@ -393,7 +393,7 @@ private fun IrConstructorCall.getValueArgument(name: Name): IrExpression? {
|
||||
private val TARGET_ALLOWED_TARGETS = Name.identifier("allowedTargets")
|
||||
|
||||
private fun IrClass.applicableTargetSet(): Set<KotlinTarget>? {
|
||||
val targetEntry = getAnnotation(KotlinBuiltInsNames.FqNames.target) ?: return null
|
||||
val targetEntry = getAnnotation(StandardNames.FqNames.target) ?: return null
|
||||
return loadAnnotationTargets(targetEntry)
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -16,7 +16,7 @@ import org.jetbrains.kotlin.backend.jvm.ir.isCompiledToJvmDefault
|
||||
import org.jetbrains.kotlin.backend.jvm.ir.isStaticInlineClassReplacement
|
||||
import org.jetbrains.kotlin.backend.jvm.ir.propertyIfAccessor
|
||||
import org.jetbrains.kotlin.backend.jvm.lower.suspendFunctionOriginal
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames
|
||||
import org.jetbrains.kotlin.builtins.StandardNames
|
||||
import org.jetbrains.kotlin.builtins.jvm.JavaToKotlinClassMap
|
||||
import org.jetbrains.kotlin.codegen.JvmCodegenUtil
|
||||
import org.jetbrains.kotlin.codegen.replaceValueParametersIn
|
||||
@@ -130,7 +130,7 @@ class MethodSignatureMapper(private val context: JvmBackendContext) {
|
||||
else null) ?: context.state.moduleName
|
||||
|
||||
private fun IrFunction.isPublishedApi(): Boolean =
|
||||
propertyIfAccessor.annotations.hasAnnotation(KotlinBuiltInsNames.FqNames.publishedApi)
|
||||
propertyIfAccessor.annotations.hasAnnotation(StandardNames.FqNames.publishedApi)
|
||||
|
||||
fun mapReturnType(declaration: IrDeclaration, sw: JvmSignatureWriter? = null): Type {
|
||||
if (declaration !is IrFunction) {
|
||||
@@ -369,7 +369,7 @@ class MethodSignatureMapper(private val context: JvmBackendContext) {
|
||||
}
|
||||
|
||||
private val IrSimpleFunction.isBuiltIn: Boolean
|
||||
get() = getPackageFragment()?.fqName == KotlinBuiltInsNames.BUILT_INS_PACKAGE_FQ_NAME ||
|
||||
get() = getPackageFragment()?.fqName == StandardNames.BUILT_INS_PACKAGE_FQ_NAME ||
|
||||
parent.safeAs<IrClass>()?.fqNameWhenAvailable?.toUnsafe()?.let(JavaToKotlinClassMap::mapKotlinToJava) != null
|
||||
|
||||
// From BuiltinMethodsWithDifferentJvmName.isBuiltinFunctionWithDifferentNameInJvm, BuiltinMethodsWithDifferentJvmName.getJvmName
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ import org.jetbrains.kotlin.backend.common.ir.ir2string
|
||||
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
|
||||
import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin
|
||||
import org.jetbrains.kotlin.backend.jvm.lower.MultifileFacadeFileEntry
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames.FqNames
|
||||
import org.jetbrains.kotlin.builtins.StandardNames.FqNames
|
||||
import org.jetbrains.kotlin.builtins.jvm.JavaToKotlinClassMap
|
||||
import org.jetbrains.kotlin.codegen.*
|
||||
import org.jetbrains.kotlin.codegen.inline.SourceMapper
|
||||
|
||||
+16
-16
@@ -17,7 +17,7 @@
|
||||
package org.jetbrains.kotlin.backend.jvm.intrinsics
|
||||
|
||||
import org.jetbrains.kotlin.backend.jvm.JvmSymbols
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames
|
||||
import org.jetbrains.kotlin.builtins.StandardNames
|
||||
import org.jetbrains.kotlin.builtins.PrimitiveType
|
||||
import org.jetbrains.kotlin.ir.declarations.IrClass
|
||||
import org.jetbrains.kotlin.ir.declarations.IrPackageFragment
|
||||
@@ -46,11 +46,11 @@ class IrIntrinsicMethods(val irBuiltIns: IrBuiltIns, val symbols: JvmSymbols) {
|
||||
private val intrinsicsMap = (
|
||||
listOf(
|
||||
Key(kotlinJvm, FqName("T"), "<get-javaClass>", emptyList()) to JavaClassProperty,
|
||||
Key(kotlinJvm, KotlinBuiltInsNames.FqNames.kClass.toSafe(), "<get-javaObjectType>", emptyList()) to GetJavaObjectType,
|
||||
Key(kotlinJvm, KotlinBuiltInsNames.FqNames.kClass.toSafe(), "<get-javaPrimitiveType>", emptyList()) to GetJavaPrimitiveType,
|
||||
Key(kotlinJvm, StandardNames.FqNames.kClass.toSafe(), "<get-javaObjectType>", emptyList()) to GetJavaObjectType,
|
||||
Key(kotlinJvm, StandardNames.FqNames.kClass.toSafe(), "<get-javaPrimitiveType>", emptyList()) to GetJavaPrimitiveType,
|
||||
Key(
|
||||
kotlinJvm,
|
||||
KotlinBuiltInsNames.FqNames.kClass.toSafe(),
|
||||
StandardNames.FqNames.kClass.toSafe(),
|
||||
"<get-java>",
|
||||
emptyList()
|
||||
) to KClassJavaProperty,
|
||||
@@ -58,49 +58,49 @@ class IrIntrinsicMethods(val irBuiltIns: IrBuiltIns, val symbols: JvmSymbols) {
|
||||
kotlinJvmInternalUnsafe,
|
||||
null,
|
||||
"access\$monitorEnter",
|
||||
listOf(KotlinBuiltInsNames.FqNames.any.toSafe())
|
||||
listOf(StandardNames.FqNames.any.toSafe())
|
||||
) to MonitorInstruction.MONITOR_ENTER,
|
||||
Key(
|
||||
kotlinJvmInternalUnsafe,
|
||||
null,
|
||||
"access\$monitorExit",
|
||||
listOf(KotlinBuiltInsNames.FqNames.any.toSafe())
|
||||
listOf(StandardNames.FqNames.any.toSafe())
|
||||
) to MonitorInstruction.MONITOR_EXIT,
|
||||
Key(
|
||||
kotlinJvm,
|
||||
KotlinBuiltInsNames.FqNames.array.toSafe(),
|
||||
StandardNames.FqNames.array.toSafe(),
|
||||
"isArrayOf",
|
||||
emptyList()
|
||||
) to IsArrayOf,
|
||||
Key(
|
||||
KotlinBuiltInsNames.BUILT_INS_PACKAGE_FQ_NAME,
|
||||
StandardNames.BUILT_INS_PACKAGE_FQ_NAME,
|
||||
null,
|
||||
"arrayOfNulls",
|
||||
listOf(KotlinBuiltInsNames.FqNames._int.toSafe())
|
||||
listOf(StandardNames.FqNames._int.toSafe())
|
||||
) to NewArray,
|
||||
Key(
|
||||
KotlinBuiltInsNames.FqNames.cloneable.toSafe(),
|
||||
StandardNames.FqNames.cloneable.toSafe(),
|
||||
null,
|
||||
"clone",
|
||||
emptyList()
|
||||
) to Clone,
|
||||
Key(
|
||||
KotlinBuiltInsNames.BUILT_INS_PACKAGE_FQ_NAME,
|
||||
StandardNames.BUILT_INS_PACKAGE_FQ_NAME,
|
||||
null,
|
||||
"enumValues",
|
||||
listOf()
|
||||
) to EnumValues,
|
||||
Key(
|
||||
KotlinBuiltInsNames.BUILT_INS_PACKAGE_FQ_NAME,
|
||||
StandardNames.BUILT_INS_PACKAGE_FQ_NAME,
|
||||
null,
|
||||
"enumValueOf",
|
||||
listOf(KotlinBuiltInsNames.FqNames.string.toSafe())
|
||||
listOf(StandardNames.FqNames.string.toSafe())
|
||||
) to EnumValueOf,
|
||||
Key(
|
||||
KotlinBuiltInsNames.BUILT_INS_PACKAGE_FQ_NAME,
|
||||
KotlinBuiltInsNames.FqNames.string.toSafe(),
|
||||
StandardNames.BUILT_INS_PACKAGE_FQ_NAME,
|
||||
StandardNames.FqNames.string.toSafe(),
|
||||
"plus",
|
||||
listOf(KotlinBuiltInsNames.FqNames.any.toSafe())
|
||||
listOf(StandardNames.FqNames.any.toSafe())
|
||||
) to StringPlus,
|
||||
irBuiltIns.eqeqSymbol.toKey()!! to Equals(KtTokens.EQEQ),
|
||||
irBuiltIns.eqeqeqSymbol.toKey()!! to Equals(KtTokens.EQEQEQ),
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
package org.jetbrains.kotlin.backend.jvm.intrinsics
|
||||
|
||||
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames.COLLECTIONS_PACKAGE_FQ_NAME
|
||||
import org.jetbrains.kotlin.builtins.StandardNames.COLLECTIONS_PACKAGE_FQ_NAME
|
||||
import org.jetbrains.kotlin.codegen.AsmUtil
|
||||
import org.jetbrains.kotlin.fileClasses.internalNameWithoutInnerClasses
|
||||
import org.jetbrains.kotlin.ir.expressions.IrFunctionAccessExpression
|
||||
|
||||
+3
-3
@@ -9,7 +9,7 @@ import org.jetbrains.kotlin.backend.common.ClassLoweringPass
|
||||
import org.jetbrains.kotlin.backend.common.ir.addChild
|
||||
import org.jetbrains.kotlin.backend.common.phaser.makeIrFilePhase
|
||||
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames
|
||||
import org.jetbrains.kotlin.builtins.StandardNames
|
||||
import org.jetbrains.kotlin.config.JvmTarget
|
||||
import org.jetbrains.kotlin.descriptors.ClassKind
|
||||
import org.jetbrains.kotlin.descriptors.annotations.KotlinRetention
|
||||
@@ -127,7 +127,7 @@ private class AdditionalClassAnnotationLowering(private val context: JvmBackendC
|
||||
}
|
||||
|
||||
private fun generateDocumentedAnnotation(irClass: IrClass) {
|
||||
if (!irClass.hasAnnotation(KotlinBuiltInsNames.FqNames.mustBeDocumented) ||
|
||||
if (!irClass.hasAnnotation(StandardNames.FqNames.mustBeDocumented) ||
|
||||
irClass.hasAnnotation(FqName("java.lang.annotation.Documented"))
|
||||
) return
|
||||
|
||||
@@ -228,7 +228,7 @@ private fun IrConstructorCall.getValueArgument(name: Name): IrExpression? {
|
||||
private val TARGET_ALLOWED_TARGETS = Name.identifier("allowedTargets")
|
||||
|
||||
private fun IrClass.applicableTargetSet(): Set<KotlinTarget>? {
|
||||
val targetEntry = getAnnotation(KotlinBuiltInsNames.FqNames.target) ?: return null
|
||||
val targetEntry = getAnnotation(StandardNames.FqNames.target) ?: return null
|
||||
return loadAnnotationTargets(targetEntry)
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -12,7 +12,7 @@ import org.jetbrains.kotlin.backend.common.lower.*
|
||||
import org.jetbrains.kotlin.backend.common.phaser.makeIrFilePhase
|
||||
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
|
||||
import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames
|
||||
import org.jetbrains.kotlin.builtins.StandardNames
|
||||
import org.jetbrains.kotlin.codegen.ASSERTIONS_DISABLED_FIELD_NAME
|
||||
import org.jetbrains.kotlin.config.JVMAssertionsMode
|
||||
import org.jetbrains.kotlin.ir.IrElement
|
||||
@@ -129,7 +129,7 @@ private class AssertionLowering(private val context: JvmBackendContext) :
|
||||
}
|
||||
|
||||
private val IrFunction.isAssert: Boolean
|
||||
get() = name.asString() == "assert" && getPackageFragment()?.fqName == KotlinBuiltInsNames.BUILT_INS_PACKAGE_FQ_NAME
|
||||
get() = name.asString() == "assert" && getPackageFragment()?.fqName == StandardNames.BUILT_INS_PACKAGE_FQ_NAME
|
||||
}
|
||||
|
||||
private fun IrBuilderWithScope.getJavaClass(backendContext: JvmBackendContext, irClass: IrClass) =
|
||||
|
||||
+4
-4
@@ -15,7 +15,7 @@ import org.jetbrains.kotlin.backend.common.phaser.makeIrFilePhase
|
||||
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
|
||||
import org.jetbrains.kotlin.backend.jvm.ir.createJvmIrBuilder
|
||||
import org.jetbrains.kotlin.backend.jvm.ir.irArray
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames
|
||||
import org.jetbrains.kotlin.builtins.StandardNames
|
||||
import org.jetbrains.kotlin.builtins.functions.FunctionInvokeDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.Modality
|
||||
import org.jetbrains.kotlin.descriptors.Visibilities
|
||||
@@ -150,7 +150,7 @@ private class FunctionNVarargBridgeLowering(val context: JvmBackendContext) :
|
||||
val fqName = clazz.parent.safeAs<IrPackageFragment>()?.fqName ?: return false
|
||||
return when {
|
||||
name.startsWith("Function") ->
|
||||
fqName == KotlinBuiltInsNames.BUILT_INS_PACKAGE_FQ_NAME || fqName == FUNCTIONS_PACKAGE_FQ_NAME
|
||||
fqName == StandardNames.BUILT_INS_PACKAGE_FQ_NAME || fqName == FUNCTIONS_PACKAGE_FQ_NAME
|
||||
name.startsWith("KFunction") ->
|
||||
fqName == REFLECT_PACKAGE_FQ_NAME
|
||||
else -> false
|
||||
@@ -169,11 +169,11 @@ private class FunctionNVarargBridgeLowering(val context: JvmBackendContext) :
|
||||
}
|
||||
|
||||
private val FUNCTIONS_PACKAGE_FQ_NAME =
|
||||
KotlinBuiltInsNames.BUILT_INS_PACKAGE_FQ_NAME
|
||||
StandardNames.BUILT_INS_PACKAGE_FQ_NAME
|
||||
.child(Name.identifier("jvm"))
|
||||
.child(Name.identifier("functions"))
|
||||
|
||||
private val REFLECT_PACKAGE_FQ_NAME =
|
||||
KotlinBuiltInsNames.BUILT_INS_PACKAGE_FQ_NAME
|
||||
StandardNames.BUILT_INS_PACKAGE_FQ_NAME
|
||||
.child(Name.identifier("reflect"))
|
||||
}
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@ import org.jetbrains.kotlin.backend.common.phaser.makeIrFilePhase
|
||||
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
|
||||
import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin
|
||||
import org.jetbrains.kotlin.backend.jvm.lower.inlineclasses.*
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames
|
||||
import org.jetbrains.kotlin.builtins.StandardNames
|
||||
import org.jetbrains.kotlin.config.ApiVersion
|
||||
import org.jetbrains.kotlin.descriptors.Visibilities
|
||||
import org.jetbrains.kotlin.ir.IrStatement
|
||||
@@ -398,7 +398,7 @@ private class JvmInlineClassLowering(private val context: JvmBackendContext) : F
|
||||
?: return false
|
||||
|
||||
// Before version 1.4, we cannot rely on the Result.equals-impl0 method
|
||||
return (leftClass.fqNameWhenAvailable != KotlinBuiltInsNames.RESULT_FQ_NAME) ||
|
||||
return (leftClass.fqNameWhenAvailable != StandardNames.RESULT_FQ_NAME) ||
|
||||
context.state.languageVersionSettings.apiVersion >= ApiVersion.KOTLIN_1_4
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -13,7 +13,7 @@ import org.jetbrains.kotlin.backend.jvm.ir.IrArrayBuilder
|
||||
import org.jetbrains.kotlin.backend.jvm.ir.createJvmIrBuilder
|
||||
import org.jetbrains.kotlin.backend.jvm.ir.irArray
|
||||
import org.jetbrains.kotlin.backend.jvm.ir.irArrayOf
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames
|
||||
import org.jetbrains.kotlin.builtins.StandardNames
|
||||
import org.jetbrains.kotlin.builtins.PrimitiveType
|
||||
import org.jetbrains.kotlin.builtins.UnsignedType
|
||||
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
||||
@@ -106,7 +106,7 @@ private class VarargLowering(val context: JvmBackendContext) : FileLoweringPass,
|
||||
|
||||
private val IrFunctionSymbol.isEmptyArray: Boolean
|
||||
get() = owner.name.asString() == "emptyArray" &&
|
||||
(owner.parent as? IrPackageFragment)?.fqName == KotlinBuiltInsNames.BUILT_INS_PACKAGE_FQ_NAME
|
||||
(owner.parent as? IrPackageFragment)?.fqName == StandardNames.BUILT_INS_PACKAGE_FQ_NAME
|
||||
|
||||
companion object {
|
||||
private val PRIMITIVE_ARRAY_OF_NAMES: Set<String> =
|
||||
@@ -122,7 +122,7 @@ private class VarargLowering(val context: JvmBackendContext) : FileLoweringPass,
|
||||
is IrPackageFragment -> directParent
|
||||
else -> return false
|
||||
}
|
||||
return parent.fqName == KotlinBuiltInsNames.BUILT_INS_PACKAGE_FQ_NAME &&
|
||||
return parent.fqName == StandardNames.BUILT_INS_PACKAGE_FQ_NAME &&
|
||||
name.asString().let { it in PRIMITIVE_ARRAY_OF_NAMES || it == ARRAY_OF_NAME } &&
|
||||
extensionReceiverParameter == null &&
|
||||
dispatchReceiverParameter == null &&
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@
|
||||
package org.jetbrains.kotlin.backend.jvm.lower.inlineclasses
|
||||
|
||||
import org.jetbrains.kotlin.backend.jvm.ir.erasedUpperBound
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames
|
||||
import org.jetbrains.kotlin.builtins.StandardNames
|
||||
import org.jetbrains.kotlin.codegen.state.md5base64
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.expressions.IrStatementOriginImpl
|
||||
@@ -114,7 +114,7 @@ object InlineClassAbi {
|
||||
internal val IrType.requiresMangling: Boolean
|
||||
get() {
|
||||
val irClass = erasedUpperBound
|
||||
return irClass.isInline && irClass.fqNameWhenAvailable != KotlinBuiltInsNames.RESULT_FQ_NAME
|
||||
return irClass.isInline && irClass.fqNameWhenAvailable != StandardNames.RESULT_FQ_NAME
|
||||
}
|
||||
|
||||
internal val IrFunction.fullValueParameterList: List<IrValueParameter>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.ir.interpreter
|
||||
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames
|
||||
import org.jetbrains.kotlin.builtins.StandardNames
|
||||
import org.jetbrains.kotlin.descriptors.ClassKind
|
||||
import org.jetbrains.kotlin.ir.interpreter.builtins.evaluateIntrinsicAnnotation
|
||||
import org.jetbrains.kotlin.ir.interpreter.stack.Variable
|
||||
@@ -207,7 +207,7 @@ internal fun IrFunction.getCapitalizedFileName() = this.file.name.replace(".kt",
|
||||
internal fun IrType.isUnsigned() = this.isUByte() || this.isUShort() || this.isUInt() || this.isULong()
|
||||
|
||||
internal fun IrType.isPrimitiveArray(): Boolean {
|
||||
return this.getClass()?.fqNameWhenAvailable?.toUnsafe()?.let { KotlinBuiltInsNames.isPrimitiveArray(it) } ?: false
|
||||
return this.getClass()?.fqNameWhenAvailable?.toUnsafe()?.let { StandardNames.isPrimitiveArray(it) } ?: false
|
||||
}
|
||||
|
||||
internal fun IrType.isFunction() = this.getClass()?.fqNameWhenAvailable?.asString()?.startsWith("kotlin.Function") ?: false
|
||||
|
||||
+2
-2
@@ -17,7 +17,7 @@
|
||||
package org.jetbrains.kotlin.psi2ir.transformations
|
||||
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames
|
||||
import org.jetbrains.kotlin.builtins.StandardNames
|
||||
import org.jetbrains.kotlin.builtins.isFunctionType
|
||||
import org.jetbrains.kotlin.builtins.isSuspendFunctionType
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
@@ -452,7 +452,7 @@ internal class InsertImplicitCasts(
|
||||
// There are several such functions (one for each built-in integer type: Byte, Short, Int, Long),
|
||||
// we need one that takes Int.
|
||||
val coercionFunction = targetType.constructor.declarationDescriptor!!.module
|
||||
.getPackage(KotlinBuiltInsNames.BUILT_INS_PACKAGE_FQ_NAME)
|
||||
.getPackage(StandardNames.BUILT_INS_PACKAGE_FQ_NAME)
|
||||
.memberScope.getContributedFunctions(Name.identifier(coercionFunName), NoLookupLocation.FROM_BACKEND)
|
||||
.find {
|
||||
val extensionReceiver = it.extensionReceiverParameter
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.ir.descriptors
|
||||
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames.KOTLIN_REFLECT_FQ_NAME
|
||||
import org.jetbrains.kotlin.builtins.StandardNames.KOTLIN_REFLECT_FQ_NAME
|
||||
import org.jetbrains.kotlin.builtins.functions.FunctionClassDescriptor
|
||||
import org.jetbrains.kotlin.builtins.functions.FunctionClassKind
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.ir.types
|
||||
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames
|
||||
import org.jetbrains.kotlin.builtins.StandardNames
|
||||
import org.jetbrains.kotlin.builtins.PrimitiveType
|
||||
import org.jetbrains.kotlin.descriptors.ClassKind
|
||||
import org.jetbrains.kotlin.descriptors.Modality
|
||||
@@ -202,10 +202,10 @@ interface IrTypeSystemContext : TypeSystemContext, TypeSystemCommonSuperTypesCon
|
||||
override fun SimpleTypeMarker.asArgumentList() = this as IrSimpleType
|
||||
|
||||
override fun TypeConstructorMarker.isAnyConstructor(): Boolean =
|
||||
this is IrClassSymbol && isClassWithFqName(KotlinBuiltInsNames.FqNames.any)
|
||||
this is IrClassSymbol && isClassWithFqName(StandardNames.FqNames.any)
|
||||
|
||||
override fun TypeConstructorMarker.isNothingConstructor(): Boolean =
|
||||
this is IrClassSymbol && isClassWithFqName(KotlinBuiltInsNames.FqNames.nothing)
|
||||
this is IrClassSymbol && isClassWithFqName(StandardNames.FqNames.nothing)
|
||||
|
||||
override fun SimpleTypeMarker.isSingleClassifierType() = true
|
||||
|
||||
@@ -246,7 +246,7 @@ interface IrTypeSystemContext : TypeSystemContext, TypeSystemCommonSuperTypesCon
|
||||
|
||||
override fun SimpleTypeMarker.isExtensionFunction(): Boolean {
|
||||
require(this is IrSimpleType)
|
||||
return this.hasAnnotation(KotlinBuiltInsNames.FqNames.extensionFunctionType)
|
||||
return this.hasAnnotation(StandardNames.FqNames.extensionFunctionType)
|
||||
}
|
||||
|
||||
override fun SimpleTypeMarker.typeDepth(): Int {
|
||||
@@ -364,7 +364,7 @@ interface IrTypeSystemContext : TypeSystemContext, TypeSystemCommonSuperTypesCon
|
||||
while (true) {
|
||||
val parent = declaration.parent
|
||||
if (parent is IrPackageFragment) {
|
||||
return parent.fqName.startsWith(KotlinBuiltInsNames.BUILT_INS_PACKAGE_NAME)
|
||||
return parent.fqName.startsWith(StandardNames.BUILT_INS_PACKAGE_NAME)
|
||||
}
|
||||
declaration = parent as? IrDeclaration ?: return false
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.ir.types
|
||||
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames
|
||||
import org.jetbrains.kotlin.builtins.StandardNames
|
||||
import org.jetbrains.kotlin.ir.descriptors.IrBuiltIns
|
||||
import org.jetbrains.kotlin.ir.symbols.FqNameEqualityChecker
|
||||
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
||||
@@ -47,7 +47,7 @@ fun IrType.isNullable(): Boolean =
|
||||
}
|
||||
|
||||
val IrType.isBoxedArray: Boolean
|
||||
get() = classOrNull?.owner?.fqNameWhenAvailable == KotlinBuiltInsNames.FqNames.array.toSafe()
|
||||
get() = classOrNull?.owner?.fqNameWhenAvailable == StandardNames.FqNames.array.toSafe()
|
||||
|
||||
fun IrType.getArrayElementType(irBuiltIns: IrBuiltIns): IrType =
|
||||
if (isBoxedArray)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.ir.types
|
||||
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames
|
||||
import org.jetbrains.kotlin.builtins.StandardNames
|
||||
import org.jetbrains.kotlin.ir.declarations.IrClass
|
||||
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol
|
||||
@@ -32,42 +32,42 @@ private fun classFqNameEquals(symbol: IrClassSymbol, fqName: FqNameUnsafe): Bool
|
||||
private fun classFqNameEquals(declaration: IrClass, fqName: FqNameUnsafe): Boolean =
|
||||
declaration.name == fqName.shortName() && fqName == declaration.fqNameWhenAvailable?.toUnsafe()
|
||||
|
||||
fun IrType.isAny(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames.any)
|
||||
fun IrType.isNullableAny(): Boolean = isNullableClassType(KotlinBuiltInsNames.FqNames.any)
|
||||
fun IrType.isAny(): Boolean = isNotNullClassType(StandardNames.FqNames.any)
|
||||
fun IrType.isNullableAny(): Boolean = isNullableClassType(StandardNames.FqNames.any)
|
||||
|
||||
fun IrType.isString(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames.string)
|
||||
fun IrType.isNullableString(): Boolean = isNullableClassType(KotlinBuiltInsNames.FqNames.string)
|
||||
fun IrType.isStringClassType(): Boolean = isClassType(KotlinBuiltInsNames.FqNames.string)
|
||||
fun IrType.isArray(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames.array)
|
||||
fun IrType.isNullableArray(): Boolean = isNullableClassType(KotlinBuiltInsNames.FqNames.array)
|
||||
fun IrType.isCollection(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames.collection.toUnsafe())
|
||||
fun IrType.isNothing(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames.nothing)
|
||||
fun IrType.isKClass(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames.kClass)
|
||||
fun IrType.isString(): Boolean = isNotNullClassType(StandardNames.FqNames.string)
|
||||
fun IrType.isNullableString(): Boolean = isNullableClassType(StandardNames.FqNames.string)
|
||||
fun IrType.isStringClassType(): Boolean = isClassType(StandardNames.FqNames.string)
|
||||
fun IrType.isArray(): Boolean = isNotNullClassType(StandardNames.FqNames.array)
|
||||
fun IrType.isNullableArray(): Boolean = isNullableClassType(StandardNames.FqNames.array)
|
||||
fun IrType.isCollection(): Boolean = isNotNullClassType(StandardNames.FqNames.collection.toUnsafe())
|
||||
fun IrType.isNothing(): Boolean = isNotNullClassType(StandardNames.FqNames.nothing)
|
||||
fun IrType.isKClass(): Boolean = isNotNullClassType(StandardNames.FqNames.kClass)
|
||||
|
||||
fun IrType.isPrimitiveType(): Boolean = KotlinBuiltInsNames.FqNames.fqNameToPrimitiveType.keys.any { isNotNullClassType(it) }
|
||||
fun IrType.isNullablePrimitiveType(): Boolean = KotlinBuiltInsNames.FqNames.fqNameToPrimitiveType.keys.any { isNullableClassType(it) }
|
||||
fun IrType.isPrimitiveType(): Boolean = StandardNames.FqNames.fqNameToPrimitiveType.keys.any { isNotNullClassType(it) }
|
||||
fun IrType.isNullablePrimitiveType(): Boolean = StandardNames.FqNames.fqNameToPrimitiveType.keys.any { isNullableClassType(it) }
|
||||
|
||||
fun IrType.isMarkedNullable() = (this as? IrSimpleType)?.hasQuestionMark ?: false
|
||||
|
||||
fun IrType.isUnit() = isNotNullClassType(KotlinBuiltInsNames.FqNames.unit)
|
||||
fun IrType.isUnit() = isNotNullClassType(StandardNames.FqNames.unit)
|
||||
|
||||
fun IrType.isBoolean(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames._boolean)
|
||||
fun IrType.isChar(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames._char)
|
||||
fun IrType.isByte(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames._byte)
|
||||
fun IrType.isShort(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames._short)
|
||||
fun IrType.isInt(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames._int)
|
||||
fun IrType.isLong(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames._long)
|
||||
fun IrType.isUByte(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames.uByteFqName.toUnsafe())
|
||||
fun IrType.isUShort(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames.uShortFqName.toUnsafe())
|
||||
fun IrType.isUInt(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames.uIntFqName.toUnsafe())
|
||||
fun IrType.isULong(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames.uLongFqName.toUnsafe())
|
||||
fun IrType.isFloat(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames._float)
|
||||
fun IrType.isDouble(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames._double)
|
||||
fun IrType.isNumber(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames.number)
|
||||
fun IrType.isBoolean(): Boolean = isNotNullClassType(StandardNames.FqNames._boolean)
|
||||
fun IrType.isChar(): Boolean = isNotNullClassType(StandardNames.FqNames._char)
|
||||
fun IrType.isByte(): Boolean = isNotNullClassType(StandardNames.FqNames._byte)
|
||||
fun IrType.isShort(): Boolean = isNotNullClassType(StandardNames.FqNames._short)
|
||||
fun IrType.isInt(): Boolean = isNotNullClassType(StandardNames.FqNames._int)
|
||||
fun IrType.isLong(): Boolean = isNotNullClassType(StandardNames.FqNames._long)
|
||||
fun IrType.isUByte(): Boolean = isNotNullClassType(StandardNames.FqNames.uByteFqName.toUnsafe())
|
||||
fun IrType.isUShort(): Boolean = isNotNullClassType(StandardNames.FqNames.uShortFqName.toUnsafe())
|
||||
fun IrType.isUInt(): Boolean = isNotNullClassType(StandardNames.FqNames.uIntFqName.toUnsafe())
|
||||
fun IrType.isULong(): Boolean = isNotNullClassType(StandardNames.FqNames.uLongFqName.toUnsafe())
|
||||
fun IrType.isFloat(): Boolean = isNotNullClassType(StandardNames.FqNames._float)
|
||||
fun IrType.isDouble(): Boolean = isNotNullClassType(StandardNames.FqNames._double)
|
||||
fun IrType.isNumber(): Boolean = isNotNullClassType(StandardNames.FqNames.number)
|
||||
|
||||
fun IrType.isComparable(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames.comparable.toUnsafe())
|
||||
fun IrType.isCharSequence(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames.charSequence)
|
||||
fun IrType.isIterable(): Boolean = isNotNullClassType(KotlinBuiltInsNames.FqNames.iterable.toUnsafe())
|
||||
fun IrType.isComparable(): Boolean = isNotNullClassType(StandardNames.FqNames.comparable.toUnsafe())
|
||||
fun IrType.isCharSequence(): Boolean = isNotNullClassType(StandardNames.FqNames.charSequence)
|
||||
fun IrType.isIterable(): Boolean = isNotNullClassType(StandardNames.FqNames.iterable.toUnsafe())
|
||||
fun IrType.isSequence(): Boolean = isNotNullClassType(FqNameUnsafe("kotlin.sequences.Sequence"))
|
||||
|
||||
fun IrType.isBooleanArray(): Boolean = isNotNullClassType(FqNameUnsafe("kotlin.BooleanArray"))
|
||||
@@ -79,5 +79,5 @@ fun IrType.isLongArray(): Boolean = isNotNullClassType(FqNameUnsafe("kotlin.Long
|
||||
fun IrType.isFloatArray(): Boolean = isNotNullClassType(FqNameUnsafe("kotlin.FloatArray"))
|
||||
fun IrType.isDoubleArray(): Boolean = isNotNullClassType(FqNameUnsafe("kotlin.DoubleArray"))
|
||||
|
||||
fun IrType.isKotlinResult(): Boolean = isNotNullClassType(KotlinBuiltInsNames.RESULT_FQ_NAME.toUnsafe())
|
||||
fun IrType.isNullableContinuation(): Boolean = isNullableClassType(KotlinBuiltInsNames.CONTINUATION_INTERFACE_FQ_NAME_RELEASE.toUnsafe())
|
||||
fun IrType.isKotlinResult(): Boolean = isNotNullClassType(StandardNames.RESULT_FQ_NAME.toUnsafe())
|
||||
fun IrType.isNullableContinuation(): Boolean = isNullableClassType(StandardNames.CONTINUATION_INTERFACE_FQ_NAME_RELEASE.toUnsafe())
|
||||
|
||||
Reference in New Issue
Block a user