Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LoggerOps: log tree name with parent name #4575

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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