add vmutils.debugNimNode
, allows using astalgo.debug in user code
#18597
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
intended to help investigate compiler issues, which to this day remains difficult and time consuming.
macros.treeRepr
is still what should be used for regular users, buttreeRepr
is a lossy representation, and oftentimes to debug issues you need access to the full PNode fields (recursively), which (currently) is the most faithfully rendered viaastalgo.debug
which doesn't hide fields (eg flags, comment field etc); this PR allows exposing it in user code so that recompiling the compiler isn't needed (which is time consuming in a multi edit-debug session)Here's how debugutils relates to vmutils:
future work
debug
, eg to render as a tree (like treeRepr) or via an html file with collapsable nodes as shown in std/prettyprints: pretty print any expression (including with cycles), customizable RFCs#385 (I've implemented this in a private branch, it helps a lot debugging issues as it gives a full snapshot of the AST with all the information present)