Add all primitive types to KotlinTypes.kt
This commit is contained in:
committed by
Yan Zhulanow
parent
6b6ccc45f0
commit
25024ff9a0
+4
@@ -84,8 +84,12 @@ class KotlinStatementFactory(private val peekCallFactory: PeekCallFactory) : Sta
|
||||
val arguments = args.joinToString { it.toCode() }
|
||||
val text = when (elementType) {
|
||||
types.BOOLEAN -> "kotlin.booleanArrayOf($arguments)"
|
||||
KotlinTypes.BYTE -> "kotlin.byteArrayOf($arguments)"
|
||||
KotlinTypes.SHORT -> "kotlin.shortArrayOf($arguments)"
|
||||
KotlinTypes.CHAR -> "kotlin.charArrayOf($arguments)"
|
||||
types.INT -> "kotlin.intArrayOf($arguments)"
|
||||
types.LONG -> "kotlin.longArrayOf($arguments)"
|
||||
KotlinTypes.FLOAT -> "kotlin.floatArrayOf($arguments)"
|
||||
types.DOUBLE -> "kotlin.doubleArrayOf($arguments)"
|
||||
else -> "kotlin.arrayOf<${types.nullable { elementType }.genericTypeName}>($arguments)"
|
||||
}
|
||||
|
||||
@@ -9,10 +9,15 @@ import com.intellij.debugger.streams.trace.impl.handler.type.*
|
||||
*/
|
||||
object KotlinTypes : Types {
|
||||
override val ANY: GenericType = ClassTypeImpl("kotlin.Any", "kotlin.Any()")
|
||||
|
||||
override val BOOLEAN: GenericType = ClassTypeImpl("kotlin.Boolean", "false")
|
||||
val BYTE: GenericType = ClassTypeImpl("kotlin.Byte", "0")
|
||||
val SHORT: GenericType = ClassTypeImpl("kotlin.Short", "0")
|
||||
val CHAR: GenericType = ClassTypeImpl("kotlin.Char", "0.toChar()")
|
||||
override val INT: GenericType = ClassTypeImpl("kotlin.Int", "0")
|
||||
override val LONG: GenericType = ClassTypeImpl("kotlin.Long", "0L")
|
||||
override val BOOLEAN: GenericType = ClassTypeImpl("kotlin.Boolean", "false")
|
||||
override val DOUBLE: GenericType = ClassTypeImpl("kotlin.Double", "0.")
|
||||
val FLOAT: GenericType = ClassTypeImpl("kotlin.Float", "0.0f")
|
||||
override val DOUBLE: GenericType = ClassTypeImpl("kotlin.Double", "0.0")
|
||||
override val STRING: GenericType = ClassTypeImpl("kotlin.String", "\"\"")
|
||||
override val EXCEPTION: GenericType = ClassTypeImpl("kotlin.Throwable", "kotlin.Throwable()")
|
||||
override val VOID: GenericType = ClassTypeImpl("kotlin.Unit", "Unit")
|
||||
@@ -27,8 +32,12 @@ object KotlinTypes : Types {
|
||||
|
||||
override fun array(elementType: GenericType): ArrayType = when (elementType) {
|
||||
BOOLEAN -> ArrayTypeImpl(BOOLEAN, { "kotlin.BooleanArray" }, { "kotlin.BooleanArray($it)" })
|
||||
BYTE -> ArrayTypeImpl(BYTE, { "kotlin.ByteArray" }, { "kotlin.ByteArray($it)" })
|
||||
SHORT -> ArrayTypeImpl(SHORT, { "kotlin.ShortArray" }, { "kotlin.ShortArray($it)" })
|
||||
CHAR -> ArrayTypeImpl(CHAR, { "kotlin.CharArray" }, { "kotlin.CharArray($it)" })
|
||||
INT -> ArrayTypeImpl(INT, { "kotlin.IntArray" }, { "kotlin.IntArray($it)" })
|
||||
LONG -> ArrayTypeImpl(LONG, { "kotlin.LongArray" }, { "kotlin.LongArray($it)" })
|
||||
FLOAT -> ArrayTypeImpl(FLOAT, { "kotlin.FloatArray" }, { "kotlin.FloatArray($it)" })
|
||||
DOUBLE -> ArrayTypeImpl(DOUBLE, { "kotlin.DoubleArray" }, { "kotlin.DoubleArray($it)" })
|
||||
else -> ArrayTypeImpl(nullable { elementType }, { "kotlin.Array<$it>" },
|
||||
{ "kotlin.arrayOfNulls<${elementType.genericTypeName}>($it)" })
|
||||
|
||||
Reference in New Issue
Block a user