Support primitive boolean arrays
This commit is contained in:
committed by
Yan Zhulanow
parent
3acb4285ea
commit
4517d3a3d0
+3
-2
@@ -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.dsl.impl.VariableImpl
|
||||||
import com.intellij.debugger.streams.trace.impl.handler.type.GenericType
|
import com.intellij.debugger.streams.trace.impl.handler.type.GenericType
|
||||||
import com.intellij.debugger.streams.wrapper.IntermediateStreamCall
|
import com.intellij.debugger.streams.wrapper.IntermediateStreamCall
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Vitaliy.Bibaev
|
* @author Vitaliy.Bibaev
|
||||||
*/
|
*/
|
||||||
@@ -84,6 +83,7 @@ class KotlinStatementFactory(private val peekCallFactory: PeekCallFactory) : Sta
|
|||||||
override fun createNewArrayExpression(elementType: GenericType, vararg args: Expression): Expression {
|
override fun createNewArrayExpression(elementType: GenericType, vararg args: Expression): Expression {
|
||||||
val arguments = args.joinToString { it.toCode() }
|
val arguments = args.joinToString { it.toCode() }
|
||||||
return when (elementType) {
|
return when (elementType) {
|
||||||
|
types.BOOLEAN -> TextExpression("kotlin.booleanArrayOf($arguments)")
|
||||||
types.INT -> TextExpression("kotlin.intArrayOf($arguments)")
|
types.INT -> TextExpression("kotlin.intArrayOf($arguments)")
|
||||||
types.LONG -> TextExpression("kotlin.longArrayOf($arguments)")
|
types.LONG -> TextExpression("kotlin.longArrayOf($arguments)")
|
||||||
types.DOUBLE -> TextExpression("kotlin.doubleArrayOf($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 =
|
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 =
|
override fun createPeekCall(elementsType: GenericType, lambda: String): IntermediateStreamCall =
|
||||||
peekCallFactory.createPeekCall(elementsType, lambda)
|
peekCallFactory.createPeekCall(elementsType, lambda)
|
||||||
|
|||||||
@@ -23,10 +23,12 @@ object KotlinTypes : Types {
|
|||||||
ListTypeImpl(elementsType, { "kotlin.collections.MutableList<$it>" }, "kotlin.collections.mutableListOf()")
|
ListTypeImpl(elementsType, { "kotlin.collections.MutableList<$it>" }, "kotlin.collections.mutableListOf()")
|
||||||
|
|
||||||
override fun array(elementType: GenericType): ArrayType = when (elementType) {
|
override fun array(elementType: GenericType): ArrayType = when (elementType) {
|
||||||
|
BOOLEAN -> ArrayTypeImpl(BOOLEAN, { "kotlin.BooleanArray" }, { "kotlin.BooleanArray($it)" })
|
||||||
INT -> ArrayTypeImpl(INT, { "kotlin.IntArray" }, { "kotlin.IntArray($it)" })
|
INT -> ArrayTypeImpl(INT, { "kotlin.IntArray" }, { "kotlin.IntArray($it)" })
|
||||||
LONG -> ArrayTypeImpl(LONG, { "kotlin.LongArray" }, { "kotlin.LongArray($it)" })
|
LONG -> ArrayTypeImpl(LONG, { "kotlin.LongArray" }, { "kotlin.LongArray($it)" })
|
||||||
DOUBLE -> ArrayTypeImpl(DOUBLE, { "kotlin.DoubleArray" }, { "kotlin.DoubleArray($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 =
|
override fun map(keyType: GenericType, valueType: GenericType): MapType =
|
||||||
|
|||||||
@@ -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 {
|
run {
|
||||||
val size: kotlin.Int = map.size
|
val size: kotlin.Int = map.size
|
||||||
val keys: kotlin.IntArray = kotlin.IntArray(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
|
var i: kotlin.Int = 0
|
||||||
for (key in map.keys) {
|
for (key in map.keys) {
|
||||||
keys[i] = key
|
keys[i] = key
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
arrayOfNulls<kotlin.String>(100)
|
kotlin.arrayOfNulls<kotlin.String>(100)
|
||||||
|
|||||||
Reference in New Issue
Block a user