This commit is contained in:
Vladimir Krivosheev
2016-05-04 17:32:16 +02:00
parent d3b97f3a79
commit 32a02359e9
4 changed files with 8 additions and 36 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,7 +39,7 @@ interface ObjectValue : Value {
* "to" could be -1 (sometimes length is unknown, so, you can pass -1 instead of actual elements size)
*/
fun getIndexedProperties(from: Int, to: Int, bucketThreshold: Int, consumer: IndexedVariablesConsumer, componentType: ValueType?): Promise<*>
fun getIndexedProperties(from: Int, to: Int, bucketThreshold: Int, consumer: IndexedVariablesConsumer, componentType: ValueType? = null): Promise<*>
/**
* It must return quickly. Return [com.intellij.util.ThreeState.UNSURE] otherwise.
@@ -1,22 +0,0 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.debugger
import com.intellij.xdebugger.frame.XValueGroup
internal interface ValueGroupFactory<T> {
fun create(data: T, start: Int, end: Int, context: VariableContext): XValueGroup
}
@@ -198,18 +198,18 @@ class VariableView(override val variableName: String, private val variable: Vari
override fun consumeRanges(ranges: IntArray?) {
if (ranges == null) {
val groupList = XValueChildrenList()
LazyVariablesGroup.addGroups(value, LazyVariablesGroup.GROUP_FACTORY, groupList, 0, value.length, XCompositeNode.MAX_CHILDREN_TO_SHOW, this@VariableView)
addGroups(value, ::lazyVariablesGroup, groupList, 0, value.length, XCompositeNode.MAX_CHILDREN_TO_SHOW, this@VariableView)
node.addChildren(groupList, isLastChildren)
}
else {
LazyVariablesGroup.addRanges(value, ranges, node, this@VariableView, isLastChildren)
addRanges(value, ranges, node, this@VariableView, isLastChildren)
}
}
override fun consumeVariables(variables: List<Variable>) {
node.addChildren(createVariablesList(variables, this@VariableView, null), isLastChildren)
}
}, null)
})
}
private fun computeNamedProperties(value: ObjectValue, node: XCompositeNode, isLastChildren: Boolean) = processVariables(this, value.properties, node) { memberFilter, variables ->
@@ -254,7 +254,7 @@ class VariableView(override val variableName: String, private val variable: Vari
val groupList = XValueChildrenList()
if (count > 0) {
LazyVariablesGroup.addGroups(variables, GROUP_FACTORY, groupList, 0, count, bucketSize, this)
addGroups(variables, ::createArrayRangeGroup, groupList, 0, count, bucketSize, this)
}
var notGroupedVariablesOffset: Int
@@ -268,7 +268,7 @@ class VariableView(override val variableName: String, private val variable: Vari
}
if (notGroupedVariablesOffset > 0) {
LazyVariablesGroup.addGroups(variables, GROUP_FACTORY, groupList, count, notGroupedVariablesOffset, bucketSize, this)
addGroups(variables, ::createArrayRangeGroup, groupList, count, notGroupedVariablesOffset, bucketSize, this)
}
}
else {
@@ -28,13 +28,7 @@ internal class VariablesGroup(private val start: Int, private val end: Int, priv
}
}
internal val GROUP_FACTORY: ValueGroupFactory<List<Variable>> = object : ValueGroupFactory<List<Variable>> {
override fun create(data: List<Variable>, start: Int, end: Int, context: VariableContext): XValueGroup {
return createArrayRangeGroup(start, end, data, context)
}
}
private fun createArrayRangeGroup(start: Int, end: Int, variables: List<Variable>, variableContext: VariableContext): VariablesGroup {
internal fun createArrayRangeGroup(variables: List<Variable>, start: Int, end: Int, variableContext: VariableContext): VariablesGroup {
val name = "[" + variables[start].name + " \u2026 " + variables[end - 1].name + "]"
return VariablesGroup(start, end, variables, variableContext, name)
}