Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
adpi2 committed Feb 7, 2024
1 parent 039c04c commit 2dbcaf8
Showing 1 changed file with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,9 @@ private[evaluator] class JdiObject(
val reference: ObjectReference,
thread: ThreadReference
) extends JdiValue(reference, thread) {
def getField(field: Field): JdiValue =
JdiValue(reference.getValue(field), thread)
def getField(field: Field): JdiValue = JdiValue(reference.getValue(field), thread)

def getField(name: String): JdiValue = {
val field = reference.referenceType.fieldByName(name)
JdiValue(reference.getValue(field), thread)
}
def getField(name: String): JdiValue = getField(reference.referenceType.fieldByName(name))

def invoke(methodName: String, args: Seq[JdiValue]): Safe[JdiValue] = {
val m = reference.referenceType.methodsByName(methodName).get(0)
Expand Down Expand Up @@ -44,8 +40,7 @@ private[evaluator] class JdiObject(

// we use a Seq instead of a Map because the ScalaEvaluator rely on the order of the fields
def fields: Seq[(String, JdiValue)] =
reference.referenceType.fields.asScala.toSeq
.map(f => (f.name, JdiValue(reference.getValue(f), thread)))
reference.referenceType.fields.asScala.toSeq.map(f => (f.name, getField(f)))
}

private[internal] object JdiObject {
Expand Down

0 comments on commit 2dbcaf8

Please sign in to comment.