[MPP] Move integer names used by commonizer to its module
KT-41509
This commit is contained in:
committed by
teamcity
parent
91a0af2aa1
commit
867390b889
+21
-20
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.commonizer.core
|
||||
|
||||
import org.jetbrains.kotlin.commonizer.cir.CirClassType
|
||||
import org.jetbrains.kotlin.commonizer.cir.CirEntityId
|
||||
import org.jetbrains.kotlin.commonizer.utils.*
|
||||
|
||||
private typealias BitWidth = Int
|
||||
|
||||
@@ -21,51 +22,51 @@ private class SubstitutableNumbers(private val numbers: Map<CirEntityId, BitWidt
|
||||
|
||||
private val signedIntegers = SubstitutableNumbers(
|
||||
mapOf(
|
||||
CirEntityId.create("kotlin/Byte") to 8,
|
||||
CirEntityId.create("kotlin/Short") to 16,
|
||||
CirEntityId.create("kotlin/Int") to 32,
|
||||
CirEntityId.create("kotlin/Long") to 64
|
||||
CirEntityId.create(KOTLIN_BYTE_ID) to 8,
|
||||
CirEntityId.create(KOTLIN_SHORT_ID) to 16,
|
||||
CirEntityId.create(KOTLIN_INT_ID) to 32,
|
||||
CirEntityId.create(KOTLIN_LONG_ID) to 64
|
||||
)
|
||||
)
|
||||
|
||||
private val unsignedIntegers = SubstitutableNumbers(
|
||||
mapOf(
|
||||
CirEntityId.create("kotlin/UByte") to 8,
|
||||
CirEntityId.create("kotlin/UShort") to 16,
|
||||
CirEntityId.create("kotlin/UInt") to 32,
|
||||
CirEntityId.create("kotlin/ULong") to 64
|
||||
CirEntityId.create(KOTLIN_UBYTE_ID) to 8,
|
||||
CirEntityId.create(KOTLIN_USHORT_ID) to 16,
|
||||
CirEntityId.create(KOTLIN_UINT_ID) to 32,
|
||||
CirEntityId.create(KOTLIN_ULONG_ID) to 64
|
||||
)
|
||||
)
|
||||
|
||||
private val floatingPoints = SubstitutableNumbers(
|
||||
mapOf(
|
||||
CirEntityId.create("kotlin/Float") to 32,
|
||||
CirEntityId.create("kotlin/Double") to 64,
|
||||
CirEntityId.create(KOTLIN_FLOAT_ID) to 32,
|
||||
CirEntityId.create(KOTLIN_DOUBLE_ID) to 64,
|
||||
)
|
||||
)
|
||||
|
||||
private val signedVarIntegers = SubstitutableNumbers(
|
||||
mapOf(
|
||||
CirEntityId.create("kotlinx/cinterop/ByteVarOf") to 8,
|
||||
CirEntityId.create("kotlinx/cinterop/ShortVarOf") to 16,
|
||||
CirEntityId.create("kotlinx/cinterop/IntVarOf") to 32,
|
||||
CirEntityId.create("kotlinx/cinterop/LongVarOf") to 64,
|
||||
CirEntityId.create(BYTE_VAR_OF_ID) to 8,
|
||||
CirEntityId.create(SHORT_VAR_OF_ID) to 16,
|
||||
CirEntityId.create(INT_VAR_OF_ID) to 32,
|
||||
CirEntityId.create(LONG_VAR_OF_ID) to 64,
|
||||
)
|
||||
)
|
||||
|
||||
private val unsignedVarIntegers = SubstitutableNumbers(
|
||||
mapOf(
|
||||
CirEntityId.create("kotlinx/cinterop/UByteVarOf") to 8,
|
||||
CirEntityId.create("kotlinx/cinterop/UShortVarOf") to 16,
|
||||
CirEntityId.create("kotlinx/cinterop/UIntVarOf") to 32,
|
||||
CirEntityId.create("kotlinx/cinterop/ULongVarOf") to 64,
|
||||
CirEntityId.create(UBYTE_VAR_OF_ID) to 8,
|
||||
CirEntityId.create(USHORT_VAR_OF_ID) to 16,
|
||||
CirEntityId.create(UINT_VAR_OF_ID) to 32,
|
||||
CirEntityId.create(ULONG_VAR_OF_ID) to 64,
|
||||
)
|
||||
)
|
||||
|
||||
private val floatingPointVars = SubstitutableNumbers(
|
||||
mapOf(
|
||||
CirEntityId.create("kotlinx/cinterop/FloatVarOf") to 32,
|
||||
CirEntityId.create("kotlinx/cinterop/DoubleVarOf") to 64,
|
||||
CirEntityId.create(FLOAT_VAR_OF_ID) to 32,
|
||||
CirEntityId.create(DOUBLE_VAR_OF_ID) to 64,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
+5
-2
@@ -6,11 +6,14 @@
|
||||
package org.jetbrains.kotlin.commonizer.core
|
||||
|
||||
import org.jetbrains.kotlin.commonizer.CommonizerTarget
|
||||
import org.jetbrains.kotlin.commonizer.cir.*
|
||||
import org.jetbrains.kotlin.commonizer.cir.CirClassOrTypeAliasType
|
||||
import org.jetbrains.kotlin.commonizer.cir.CirClassType
|
||||
import org.jetbrains.kotlin.commonizer.cir.CirEntityId
|
||||
import org.jetbrains.kotlin.commonizer.cir.CirTypeProjection
|
||||
import org.jetbrains.kotlin.commonizer.mergedtree.CirKnownClassifiers
|
||||
import org.jetbrains.kotlin.commonizer.mergedtree.PlatformIntWidth
|
||||
import org.jetbrains.kotlin.commonizer.mergedtree.PlatformWidthIndex
|
||||
import org.jetbrains.kotlin.descriptors.konan.*
|
||||
import org.jetbrains.kotlin.commonizer.utils.*
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.utils.SmartList
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import org.jetbrains.kotlin.builtins.StandardNames
|
||||
import org.jetbrains.kotlin.commonizer.cir.CirEntityId
|
||||
import org.jetbrains.kotlin.commonizer.cir.CirName
|
||||
import org.jetbrains.kotlin.commonizer.cir.CirPackageName
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.serialization.konan.impl.ForwardDeclarationsFqNames
|
||||
@@ -76,4 +77,63 @@ internal val CirEntityId.isObjCInteropCallableAnnotation: Boolean
|
||||
get() = this == COMMONIZER_OBJC_INTEROP_CALLABLE_ANNOTATION_ID ||
|
||||
packageName == CINTEROP_PACKAGE && relativeNameSegments.singleOrNull() in OBJC_INTEROP_CALLABLE_ANNOTATIONS
|
||||
|
||||
// platform integers/optimistic commonization
|
||||
|
||||
val KOTLIN_BYTE_ID = ClassId.fromString("kotlin/Byte")
|
||||
val KOTLIN_SHORT_ID = ClassId.fromString("kotlin/Short")
|
||||
val KOTLIN_INT_ID = ClassId.fromString("kotlin/Int")
|
||||
val KOTLIN_LONG_ID = ClassId.fromString("kotlin/Long")
|
||||
|
||||
val KOTLIN_UBYTE_ID = ClassId.fromString("kotlin/UByte")
|
||||
val KOTLIN_USHORT_ID = ClassId.fromString("kotlin/UShort")
|
||||
val KOTLIN_UINT_ID = ClassId.fromString("kotlin/UInt")
|
||||
val KOTLIN_ULONG_ID = ClassId.fromString("kotlin/ULong")
|
||||
|
||||
val KOTLIN_FLOAT_ID = ClassId.fromString("kotlin/Float")
|
||||
val KOTLIN_DOUBLE_ID = ClassId.fromString("kotlin/Double")
|
||||
|
||||
val BYTE_VAR_OF_ID = ClassId.fromString("kotlinx/cinterop/ByteVarOf")
|
||||
val SHORT_VAR_OF_ID = ClassId.fromString("kotlinx/cinterop/ShortVarOf")
|
||||
val INT_VAR_OF_ID = ClassId.fromString("kotlinx/cinterop/IntVarOf")
|
||||
val LONG_VAR_OF_ID = ClassId.fromString("kotlinx/cinterop/LongVarOf")
|
||||
|
||||
val UBYTE_VAR_OF_ID = ClassId.fromString("kotlinx/cinterop/UByteVarOf")
|
||||
val USHORT_VAR_OF_ID = ClassId.fromString("kotlinx/cinterop/UShortVarOf")
|
||||
val UINT_VAR_OF_ID = ClassId.fromString("kotlinx/cinterop/UIntVarOf")
|
||||
val ULONG_VAR_OF_ID = ClassId.fromString("kotlinx/cinterop/ULongVarOf")
|
||||
|
||||
val FLOAT_VAR_OF_ID = ClassId.fromString("kotlinx/cinterop/FloatVarOf")
|
||||
val DOUBLE_VAR_OF_ID = ClassId.fromString("kotlinx/cinterop/DoubleVarOf")
|
||||
|
||||
val INT_ARRAY_ID = ClassId.fromString("kotlin/IntArray")
|
||||
val LONG_ARRAY_ID = ClassId.fromString("kotlin/LongArray")
|
||||
|
||||
val UINT_ARRAY_ID = ClassId.fromString("kotlin/UIntArray")
|
||||
val ULONG_ARRAY_ID = ClassId.fromString("kotlin/ULongArray")
|
||||
|
||||
val INT_RANGE_ID = ClassId.fromString("kotlin/ranges/IntRange")
|
||||
val LONG_RANGE_ID = ClassId.fromString("kotlin/ranges/LongRange")
|
||||
|
||||
val UINT_RANGE_ID = ClassId.fromString("kotlin/ranges/UIntRange")
|
||||
val ULONG_RANGE_ID = ClassId.fromString("kotlin/ranges/ULongRange")
|
||||
|
||||
val INT_PROGRESSION_ID = ClassId.fromString("kotlin/ranges/IntProgression")
|
||||
val LONG_PROGRESSION_ID = ClassId.fromString("kotlin/ranges/LongProgression")
|
||||
|
||||
val UINT_PROGRESSION_ID = ClassId.fromString("kotlin/ranges/UIntProgression")
|
||||
val ULONG_PROGRESSION_ID = ClassId.fromString("kotlin/ranges/ULongProgression")
|
||||
|
||||
val PLATFORM_INT_ID = ClassId.fromString("kotlin/PlatformInt")
|
||||
val PLATFORM_UINT_ID = ClassId.fromString("kotlin/PlatformUInt")
|
||||
|
||||
val PLATFORM_INT_VAR_OF_ID = ClassId.fromString("kotlinx/cinterop/PlatformIntVarOf")
|
||||
val PLATFORM_UINT_VAR_OF_ID = ClassId.fromString("kotlinx/cinterop/PlatformUIntVarOf")
|
||||
|
||||
val PLATFORM_INT_ARRAY_ID = ClassId.fromString("kotlin/PlatformIntArray")
|
||||
val PLATFORM_UINT_ARRAY_ID = ClassId.fromString("kotlin/PlatformUIntArray")
|
||||
|
||||
val PLATFORM_INT_RANGE_ID = ClassId.fromString("kotlin/ranges/PlatformIntRange")
|
||||
val PLATFORM_UINT_RANGE_ID = ClassId.fromString("kotlin/ranges/PlatformUIntRange")
|
||||
|
||||
val PLATFORM_INT_PROGRESSION_ID = ClassId.fromString("kotlin/ranges/PlatformIntProgression")
|
||||
val PLATFORM_UINT_PROGRESSION_ID = ClassId.fromString("kotlin/ranges/PlatformUIntProgression")
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* 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.descriptors.konan
|
||||
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
|
||||
val KOTLIN_INT_ID = ClassId.fromString("kotlin/Int")
|
||||
val KOTLIN_LONG_ID = ClassId.fromString("kotlin/Long")
|
||||
|
||||
val KOTLIN_UINT_ID = ClassId.fromString("kotlin/UInt")
|
||||
val KOTLIN_ULONG_ID = ClassId.fromString("kotlin/ULong")
|
||||
|
||||
val INT_VAR_OF_ID = ClassId.fromString("kotlinx/cinterop/IntVarOf")
|
||||
val LONG_VAR_OF_ID = ClassId.fromString("kotlinx/cinterop/LongVarOf")
|
||||
|
||||
val UINT_VAR_OF_ID = ClassId.fromString("kotlinx/cinterop/UIntVarOf")
|
||||
val ULONG_VAR_OF_ID = ClassId.fromString("kotlinx/cinterop/ULongVarOf")
|
||||
|
||||
val INT_ARRAY_ID = ClassId.fromString("kotlin/IntArray")
|
||||
val LONG_ARRAY_ID = ClassId.fromString("kotlin/LongArray")
|
||||
|
||||
val UINT_ARRAY_ID = ClassId.fromString("kotlin/UIntArray")
|
||||
val ULONG_ARRAY_ID = ClassId.fromString("kotlin/ULongArray")
|
||||
|
||||
val INT_RANGE_ID = ClassId.fromString("kotlin/ranges/IntRange")
|
||||
val LONG_RANGE_ID = ClassId.fromString("kotlin/ranges/LongRange")
|
||||
|
||||
val UINT_RANGE_ID = ClassId.fromString("kotlin/ranges/UIntRange")
|
||||
val ULONG_RANGE_ID = ClassId.fromString("kotlin/ranges/ULongRange")
|
||||
|
||||
val INT_PROGRESSION_ID = ClassId.fromString("kotlin/ranges/IntProgression")
|
||||
val LONG_PROGRESSION_ID = ClassId.fromString("kotlin/ranges/LongProgression")
|
||||
|
||||
val UINT_PROGRESSION_ID = ClassId.fromString("kotlin/ranges/UIntProgression")
|
||||
val ULONG_PROGRESSION_ID = ClassId.fromString("kotlin/ranges/ULongProgression")
|
||||
|
||||
val PLATFORM_INT_ID = ClassId.fromString("kotlin/PlatformInt")
|
||||
val PLATFORM_UINT_ID = ClassId.fromString("kotlin/PlatformUInt")
|
||||
|
||||
val PLATFORM_INT_VAR_OF_ID = ClassId.fromString("kotlinx/cinterop/PlatformIntVarOf")
|
||||
val PLATFORM_UINT_VAR_OF_ID = ClassId.fromString("kotlinx/cinterop/PlatformUIntVarOf")
|
||||
|
||||
val PLATFORM_INT_ARRAY_ID = ClassId.fromString("kotlin/PlatformIntArray")
|
||||
val PLATFORM_UINT_ARRAY_ID = ClassId.fromString("kotlin/PlatformUIntArray")
|
||||
|
||||
val PLATFORM_INT_RANGE_ID = ClassId.fromString("kotlin/ranges/PlatformIntRange")
|
||||
val PLATFORM_UINT_RANGE_ID = ClassId.fromString("kotlin/ranges/PlatformUIntRange")
|
||||
|
||||
val PLATFORM_INT_PROGRESSION_ID = ClassId.fromString("kotlin/ranges/PlatformIntProgression")
|
||||
val PLATFORM_UINT_PROGRESSION_ID = ClassId.fromString("kotlin/ranges/PlatformUIntProgression")
|
||||
|
||||
val PLATFORM_INTEGERS: Set<ClassId> = setOf(
|
||||
PLATFORM_INT_ID, PLATFORM_UINT_ID
|
||||
)
|
||||
|
||||
val PLATFORM_VARIABLES: Set<ClassId> = setOf(
|
||||
PLATFORM_INT_VAR_OF_ID, PLATFORM_UINT_VAR_OF_ID
|
||||
)
|
||||
|
||||
val PLATFORM_ARRAYS: Set<ClassId> = setOf(
|
||||
PLATFORM_INT_ARRAY_ID, PLATFORM_UINT_ARRAY_ID
|
||||
)
|
||||
|
||||
val PLATFORM_RANGES: Set<ClassId> = setOf(
|
||||
PLATFORM_INT_RANGE_ID, PLATFORM_UINT_RANGE_ID
|
||||
)
|
||||
|
||||
val PLATFORM_PROGRESSIONS: Set<ClassId> = setOf(
|
||||
PLATFORM_INT_PROGRESSION_ID, PLATFORM_UINT_PROGRESSION_ID
|
||||
)
|
||||
|
||||
val PLATFORM_TYPES: Set<ClassId> =
|
||||
PLATFORM_INTEGERS + PLATFORM_VARIABLES + PLATFORM_ARRAYS + PLATFORM_RANGES + PLATFORM_PROGRESSIONS
|
||||
Reference in New Issue
Block a user