[FIR] Add mapping of primitive types to JVM signatures

This commit is contained in:
Dmitriy Novozhilov
2020-02-17 10:52:53 +03:00
parent 031952268a
commit d10e56c358
5 changed files with 39 additions and 1 deletions
@@ -71,7 +71,28 @@ private fun StringBuilder.appendErasedType(typeRef: FirTypeRef) {
}
}
private val PRIMITIVE_TYPE_SIGNATURE: Map<String, String> = mapOf(
"Boolean" to "Z",
"Byte" to "B",
"Char" to "C",
"Short" to "S",
"Int" to "I",
"Long" to "L",
"Float" to "F",
"Double" to "D",
)
private fun StringBuilder.appendConeType(coneType: ConeKotlinType) {
(coneType as? ConeClassLikeType)?.let {
val classId = it.lookupTag.classId
if (classId.packageFqName.toString() == "kotlin") {
PRIMITIVE_TYPE_SIGNATURE[classId.shortClassName.identifier]?.let {
append(it)
return
}
}
}
fun appendClassLikeType(type: ConeClassLikeType) {
append("L")
val classId = type.lookupTag.classId