Skip to content

Commit

Permalink
Merged branch idea243.release into idea243.x
Browse files Browse the repository at this point in the history
  • Loading branch information
builduser committed Dec 12, 2024
2 parents 44ba1fc + 46e4d1c commit c0779aa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,5 +161,5 @@ could.not.find.bitmap.field=Could not find bitmap field {0}
could.not.find.accessor.method=Could not find accessor method for field {0}
initialize.lazy.val=Initialize
lazy.val.not.initialized=<not initialized>
lazy.val.being.initialized=<being initialized>
lazy.val.being.initialized=<initializing\u2026>
collection.element.descriptors.evaluation.not.supported="Evaluation of collection element descriptors is not supported"
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ class ScalaCollectionRenderer extends ScalaClassRenderer {

private def renderStrictCollection(ref: ObjectReference, builder: ChildrenBuilder, context: EvaluationContext, index: Int): CompletableFuture[Unit] =
onDebuggerManagerThread(context) {
val dropped = evaluateDrop(ref, index, context)
val taken = evaluateTake(dropped, 100, context)
val vector = evaluateToVector(taken, context)
val vector = evaluateVectorSlice(ref, index, 100, context)
val vectorSize = evaluateSize(vector, context)
val descs = (0 until vectorSize).map { i =>
val v = evaluateVectorApply(vector, i, context)
Expand All @@ -91,9 +89,7 @@ class ScalaCollectionRenderer extends ScalaClassRenderer {
private def renderNonStrictCollection(ref: ObjectReference, builder: ChildrenBuilder, context: EvaluationContext, index: Int): CompletableFuture[Unit] =
onDebuggerManagerThread(context) {
def renderNextElement(index: Int): CompletableFuture[Unit] = onDebuggerManagerThread(context) {
val dropped = evaluateDrop(ref, index, context)
val taken = evaluateTake(dropped, 1, context)
val vector = evaluateToVector(taken, context)
val vector = evaluateVectorSlice(ref, index, 1, context)
val length = evaluateSize(vector, context)
if (length == 1) {
val desc = new CollectionElementDescriptor(context.getProject, index, evaluateVectorApply(vector, 0, context))
Expand Down Expand Up @@ -164,20 +160,26 @@ private object ScalaCollectionRenderer {
Seq(new IntEvaluator(n))
).asExpressionEvaluator.evaluate(context).asInstanceOf[ObjectReference]

def evaluateDrop(ref: ObjectReference, n: Int, context: EvaluationContext): ObjectReference =
private def evaluateDrop(ref: ObjectReference, n: Int, context: EvaluationContext): ObjectReference =
evaluateIterableOperation("drop")(ref, n, context)

def evaluateTake(ref: ObjectReference, n: Int, context: EvaluationContext): ObjectReference =
private def evaluateTake(ref: ObjectReference, n: Int, context: EvaluationContext): ObjectReference =
evaluateIterableOperation("take")(ref, n, context)

def evaluateToVector(ref: ObjectReference, context: EvaluationContext): ObjectReference =
private def evaluateToVector(ref: ObjectReference, context: EvaluationContext): ObjectReference =
ScalaMethodEvaluator(
new IdentityEvaluator(ref),
"toVector",
JVMNameUtil.getJVMRawText("()Lscala/collection/immutable/Vector;"),
Seq.empty
).asExpressionEvaluator.evaluate(context).asInstanceOf[ObjectReference]

def evaluateVectorSlice(ref: ObjectReference, offset: Int, length: Int, context: EvaluationContext): ObjectReference = {
val dropped = evaluateDrop(ref, offset, context)
val taken = evaluateTake(dropped, length, context)
evaluateToVector(taken, context)
}

def evaluateVectorApply(ref: ObjectReference, n: Int, context: EvaluationContext): Value =
ScalaMethodEvaluator(
new IdentityEvaluator(ref),
Expand Down

0 comments on commit c0779aa

Please sign in to comment.