1
0
Fork 0
mirror of https://github.com/imjasonh/nescript synced 2026-07-08 00:45:38 +00:00

CLI: --call-graph flag

Prints a tree view of every function/handler and its direct
callees, plus the max call depth reached from each state-handler
entry point. Useful for stack-budget investigation since the NES
has only 256 bytes of stack.

    === Call Graph (max depth: 2 / 8) ===
    Main::frame (max depth 2)
      ├── clamp
      ├── clamp
      └── check_collision
    check_collision
      ├── abs_diff
      └── abs_diff
    abs_diff
      └── (leaf)
    clamp
      └── (leaf)

Max-depth labels are only shown on entry points where the analyzer
has computed a depth; transitive callees print without a label so
the output isn't confusing.

https://claude.ai/code/session_01W6eQFStA66EuMKHUFo2rx3
This commit is contained in:
Claude 2026-04-12 17:46:13 +00:00
parent db234a6ca7
commit 6e007774e4
No known key found for this signature in database
2 changed files with 53 additions and 0 deletions

View file

@ -944,6 +944,7 @@ nescript build game.ne --dump-ir
| `--asm-dump` | Dump generated 6502 assembly to stdout |
| `--dump-ir` | Dump the lowered IR program (after optimization) to stdout |
| `--memory-map` | Dump a memory map of variable allocations to stdout |
| `--call-graph` | Dump a call graph (which handler/function calls which) to stdout |
| `--use-ast` | Use the legacy AST-based codegen (default is the IR codegen) |
### Check