[FIR] Fix varargs of unsigned numbers
This commit is contained in:
@@ -14,8 +14,9 @@ object StandardClassIds {
|
||||
private val BASE_KOTLIN_PACKAGE = FqName("kotlin")
|
||||
private val BASE_REFLECT_PACKAGE = BASE_KOTLIN_PACKAGE.child(Name.identifier("reflect"))
|
||||
private fun String.baseId() = ClassId(BASE_KOTLIN_PACKAGE, Name.identifier(this))
|
||||
private fun ClassId.unsignedId() = ClassId(BASE_KOTLIN_PACKAGE, Name.identifier("U" + shortClassName.identifier))
|
||||
private fun String.reflectId() = ClassId(BASE_REFLECT_PACKAGE, Name.identifier(this))
|
||||
private fun Name.arrayId() = ClassId(Array.packageFqName, Name.identifier(identifier + Array.shortClassName.identifier))
|
||||
private fun Name.primitiveArrayId() = ClassId(Array.packageFqName, Name.identifier(identifier + Array.shortClassName.identifier))
|
||||
|
||||
val Nothing = "Nothing".baseId()
|
||||
val Unit = "Unit".baseId()
|
||||
@@ -33,6 +34,11 @@ object StandardClassIds {
|
||||
val Float = "Float".baseId()
|
||||
val Double = "Double".baseId()
|
||||
|
||||
val UByte = Byte.unsignedId()
|
||||
val UShort = Short.unsignedId()
|
||||
val UInt = Int.unsignedId()
|
||||
val ULong = Long.unsignedId()
|
||||
|
||||
val String = "String".baseId()
|
||||
|
||||
val KProperty = "KProperty".reflectId()
|
||||
@@ -45,20 +51,19 @@ object StandardClassIds {
|
||||
fun byName(name: String) = name.baseId()
|
||||
fun reflectByName(name: String) = name.reflectId()
|
||||
|
||||
val primitiveArrayTypeByElementType: Map<ClassId, ClassId> = mutableMapOf<ClassId, ClassId>().apply {
|
||||
fun addPrimitive(id: ClassId) {
|
||||
put(id, id.shortClassName.arrayId())
|
||||
}
|
||||
|
||||
addPrimitive(Boolean)
|
||||
addPrimitive(Char)
|
||||
addPrimitive(Byte)
|
||||
addPrimitive(Short)
|
||||
addPrimitive(Int)
|
||||
addPrimitive(Long)
|
||||
addPrimitive(Float)
|
||||
addPrimitive(Double)
|
||||
}
|
||||
val primitiveTypes = listOf(
|
||||
Boolean, Char,
|
||||
Byte, Short, Int, Long,
|
||||
Float, Double
|
||||
)
|
||||
|
||||
val elementTypeByPrimitiveArrayType = primitiveArrayTypeByElementType.map { (k, v) -> v to k }.toMap()
|
||||
val primitiveArrayTypeByElementType = primitiveTypes.associate { id -> id to id.shortClassName.primitiveArrayId() }
|
||||
val elementTypeByPrimitiveArrayType = primitiveArrayTypeByElementType.inverseMap()
|
||||
|
||||
val unsignedTypes = listOf(UByte, UShort, UInt, ULong)
|
||||
val unsignedArrayTypeByElementType = unsignedTypes.associate { id -> id to id.shortClassName.primitiveArrayId() }
|
||||
val elementTypeByUnsignedArrayType = unsignedArrayTypeByElementType.inverseMap()
|
||||
}
|
||||
|
||||
private fun <K, V> Map<K, V>.inverseMap() = entries.associate { (k, v) -> v to k }
|
||||
Reference in New Issue
Block a user