From 25024ff9a0cfe6ef7525273be57b24bc89b8c336 Mon Sep 17 00:00:00 2001 From: "Vitaliy.Bibaev" Date: Fri, 17 Nov 2017 17:34:59 +0300 Subject: [PATCH] Add all primitive types to KotlinTypes.kt --- .../kotlin/trace/dsl/KotlinStatementFactory.kt | 4 ++++ .../streams/kotlin/trace/dsl/KotlinTypes.kt | 13 +++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/idea/idea-jvm/src/com/intellij/debugger/streams/kotlin/trace/dsl/KotlinStatementFactory.kt b/idea/idea-jvm/src/com/intellij/debugger/streams/kotlin/trace/dsl/KotlinStatementFactory.kt index 593dbc20e28..786f0f7d72b 100644 --- a/idea/idea-jvm/src/com/intellij/debugger/streams/kotlin/trace/dsl/KotlinStatementFactory.kt +++ b/idea/idea-jvm/src/com/intellij/debugger/streams/kotlin/trace/dsl/KotlinStatementFactory.kt @@ -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)" } diff --git a/idea/idea-jvm/src/com/intellij/debugger/streams/kotlin/trace/dsl/KotlinTypes.kt b/idea/idea-jvm/src/com/intellij/debugger/streams/kotlin/trace/dsl/KotlinTypes.kt index 757849b49f0..9552cf23db1 100644 --- a/idea/idea-jvm/src/com/intellij/debugger/streams/kotlin/trace/dsl/KotlinTypes.kt +++ b/idea/idea-jvm/src/com/intellij/debugger/streams/kotlin/trace/dsl/KotlinTypes.kt @@ -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)" })