Support primitive boolean arrays

This commit is contained in:
Vitaliy.Bibaev
2017-11-16 16:02:42 +03:00
committed by Yan Zhulanow
parent 3acb4285ea
commit 4517d3a3d0
4 changed files with 9 additions and 6 deletions
@@ -7,7 +7,6 @@ import com.intellij.debugger.streams.trace.dsl.impl.TextExpression
import com.intellij.debugger.streams.trace.dsl.impl.VariableImpl
import com.intellij.debugger.streams.trace.impl.handler.type.GenericType
import com.intellij.debugger.streams.wrapper.IntermediateStreamCall
/**
* @author Vitaliy.Bibaev
*/
@@ -84,6 +83,7 @@ class KotlinStatementFactory(private val peekCallFactory: PeekCallFactory) : Sta
override fun createNewArrayExpression(elementType: GenericType, vararg args: Expression): Expression {
val arguments = args.joinToString { it.toCode() }
return when (elementType) {
types.BOOLEAN -> TextExpression("kotlin.booleanArrayOf($arguments)")
types.INT -> TextExpression("kotlin.intArrayOf($arguments)")
types.LONG -> TextExpression("kotlin.longArrayOf($arguments)")
types.DOUBLE -> TextExpression("kotlin.doubleArrayOf($arguments)")
@@ -92,7 +92,8 @@ class KotlinStatementFactory(private val peekCallFactory: PeekCallFactory) : Sta
}
override fun createNewSizedArray(elementType: GenericType, size: Expression): Expression =
TextExpression("arrayOfNulls<${elementType.genericTypeName}>(${size.toCode()})")
TextExpression(types.array(elementType).sizedDeclaration(size.toCode()))
override fun createPeekCall(elementsType: GenericType, lambda: String): IntermediateStreamCall =
peekCallFactory.createPeekCall(elementsType, lambda)
@@ -23,10 +23,12 @@ object KotlinTypes : Types {
ListTypeImpl(elementsType, { "kotlin.collections.MutableList<$it>" }, "kotlin.collections.mutableListOf()")
override fun array(elementType: GenericType): ArrayType = when (elementType) {
BOOLEAN -> ArrayTypeImpl(BOOLEAN, { "kotlin.BooleanArray" }, { "kotlin.BooleanArray($it)" })
INT -> ArrayTypeImpl(INT, { "kotlin.IntArray" }, { "kotlin.IntArray($it)" })
LONG -> ArrayTypeImpl(LONG, { "kotlin.LongArray" }, { "kotlin.LongArray($it)" })
DOUBLE -> ArrayTypeImpl(DOUBLE, { "kotlin.DoubleArray" }, { "kotlin.DoubleArray($it)" })
else -> ArrayTypeImpl(nullable { elementType }, { "kotlin.Array<$it>" }, { "kotlin.arrayOfNulls($it)" })
else -> ArrayTypeImpl(nullable { elementType }, { "kotlin.Array<$it>" },
{ "kotlin.arrayOfNulls<${elementType.genericTypeName}>($it)" })
}
override fun map(keyType: GenericType, valueType: GenericType): MapType =
+2 -2
View File
@@ -1,8 +1,8 @@
var resultArray: kotlin.Array<kotlin.Any?> = arrayOfNulls<kotlin.Any>(0)
var resultArray: kotlin.Array<kotlin.Any?> = kotlin.arrayOfNulls<kotlin.Any>(0)
run {
val size: kotlin.Int = map.size
val keys: kotlin.IntArray = kotlin.IntArray(size)
val values: kotlin.Array<kotlin.Any?> = kotlin.arrayOfNulls(size)
val values: kotlin.Array<kotlin.Any?> = kotlin.arrayOfNulls<kotlin.Any>(size)
var i: kotlin.Int = 0
for (key in map.keys) {
keys[i] = key
+1 -1
View File
@@ -1 +1 @@
arrayOfNulls<kotlin.String>(100)
kotlin.arrayOfNulls<kotlin.String>(100)