Skip to content

Recursion tree: show argument values, not the class and this pointer - #35

Merged
sumnoon merged 1 commit into
mainfrom
fix/tree-labels
Sep 26, 2026
Merged

sumnoon merged 1 commit into
mainfrom
fix/tree-labels

Conversation

@sumnoon

@sumnoon sumnoon commented Sep 26, 2026

Copy link
Copy Markdown
Owner

Problem

For a method such as LeetCode's Solution::towerOfHanoi, each recursion-tree node was labelled

Solution::towerOfHanoi(0x5ffdef, 1, "A", "C", "B")

The first "argument" is the hidden this pointer, which is a memory address. Full-size nodes also cut labels at 15 characters, so every node read Solution::towe… and none of the argument values were visible. The top bar showed Solution::tower… too.

Fix

  • Labels leave out this. Nobody passes it, and its address changes every run.
  • Labels drop the class or namespace qualifier: towerOfHanoi(2, "B", "C", "A"). Plain functions are unchanged. The Call stack keeps the full name.
  • Full nodes widen to fit the longest label, from the old 15 characters up to 32. Compact nodes allow 32 characters too (was 24) and get a bit more padding, so ×2 no longer touches the label.
  • The running-call name in the top bar and the "Inspecting …" chip use the short name. The full name is in the tooltip.

The "Repeated work" grouping now matches calls on their real arguments, without the this address.

Checks

  • Tower of Hanoi (LeetCode harness, n = 3): nodes read towerOfHanoi(1, "B", "A", "C"), towerOfHanoi(0, "C", "A", "B") ×2, and so on. The sticky note says towerOfHanoi(0, "C", "A", "B") is running.
  • Fibonacci example: unchanged. Short labels keep the old 168px minimum width.
  • tsc, npm run build and the 13 Node tests pass.

docs/usage.md describes the labels.

🤖 Generated with Claude Code

Method calls such as Solution::towerOfHanoi were labelled with their class
and the hidden this pointer, e.g. "Solution::towerOfHanoi(0x5ffdef, 1, ...)",
and full nodes cut labels at 15 characters, so every node read
"Solution::towe..." and no value was visible. Labels now leave out `this`
and the class qualifier, and nodes grow to fit up to 32 characters. The
running-call name in the top bar is shortened the same way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sumnoon
sumnoon merged commit ae39872 into main Sep 26, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant