Skip to content

Commit

Permalink
LoggerOps: log tree name with parent name
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Nov 21, 2024
1 parent ac15c34 commit 1a3449d
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ object LoggerOps {
val rt = ft.meta.right.text
val ls = tokWithoutPos(ft.left)
val rs = tokWithoutPos(ft.right)
val lo = treeName(ft.leftOwner)
val ro = treeName(ft.rightOwner)
val lo = treeNameWithParent(ft.leftOwner)
val ro = treeNameWithParent(ft.rightOwner)
s"[${ft.idx}] $lt $rt >>> $ls | $rs >>> $lo | $ro"
}

Expand Down Expand Up @@ -103,7 +103,13 @@ object LoggerOps {
}
}

def treeInfo(t: Tree): String = s"${treeName(t)} ${position(t)}"
def treeName(t: Option[Tree]): String = t.fold("")(treeName)

def treeNameWithParent(t: Tree): String =
s"${treeName(t)} [${treeName(t.parent)}]"

def treeInfo(t: Tree): String =
s"${treeName(t)} ${position(t)} [${treeName(t.parent)}]"

def log(t: Tree): String = log(t, false)
def log(t: Tree, tokensOnly: Boolean): String = {
Expand Down

0 comments on commit 1a3449d

Please sign in to comment.