Use index by array name instead of elements name in KotlinTypes

This commit is contained in:
Vitaliy.Bibaev
2017-12-20 18:27:49 +03:00
committed by Yan Zhulanow
parent 43614a1dfe
commit b7e99a75ad
@@ -65,9 +65,14 @@ object KotlinTypes : Types {
}
}
private val primitiveTypesIndex: Map<String, GenericType> = listOf(KotlinTypes.BOOLEAN, KotlinTypes.BYTE, KotlinTypes.INT, KotlinTypes.SHORT,
KotlinTypes.CHAR, KotlinTypes.LONG, KotlinTypes.FLOAT, KotlinTypes.DOUBLE).associate { it.genericTypeName to it }
private val primitiveArraysIndex: Map<String, ArrayType> = primitiveTypesIndex.asSequence().associate { it.key to array(it.value) }
private val primitiveTypesIndex: Map<String, GenericType> =
listOf(KotlinTypes.BOOLEAN, KotlinTypes.BYTE, KotlinTypes.INT, KotlinTypes.SHORT,
KotlinTypes.CHAR, KotlinTypes.LONG, KotlinTypes.FLOAT, KotlinTypes.DOUBLE)
.associate { it.genericTypeName to it }
private val primitiveArraysIndex: Map<String, ArrayType> = primitiveTypesIndex.asSequence()
.map { array(it.value) }
.associate { it.genericTypeName to it }
fun primitiveTypeByName(typeName: String): GenericType? = primitiveTypesIndex[typeName]