-
Notifications
You must be signed in to change notification settings - Fork 297
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/astinternal: make it easier to debug references
The `astutil.Sanitize` logic tries to respect `Ident.Node` references, but when debugging generated syntax, it's hard to be sure whether the Node references are pointing to the correct places. This adds functionality to `astinternal.AppendDebug` to cause it to print references and their referred-to nodes in a somewhat friendly manner. Here's a (slightly abbreviated) example of its output from a recent debugging session: Value: *ast.StructLit@ref001{ Elts: []ast.Decl{ *ast.Field{ Label: *ast.Ident{ Name: "next" } Value: *ast.Ident{ Name: "_schema" Node: @ref001 (*ast.StructLit) } } } } Signed-off-by: Roger Peppe <rogpeppe@gmail.com> Change-Id: I2f859f3b8d365c6ba3408902039f2aa9cbd8a679 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1205069 Reviewed-by: Daniel Martí <mvdan@mvdan.cc> Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com> TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
- Loading branch information
Showing
4 changed files
with
104 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters