Skip to content

Commit

Permalink
internal/core/adt: pass closeContext to openDebugGraph
Browse files Browse the repository at this point in the history
This allows indicating for which closeContext a graph was
opened, for added context, and it allows each graph to
retain its own window.

Signed-off-by: Marcel van Lohuizen <[email protected]>
Change-Id: I8d973b9b90998d2be754371d6ab267c6ddabb12d
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1205362
TryBot-Result: CUEcueckoo <[email protected]>
Reviewed-by: Matthew Sackman <[email protected]>
Unity-Result: CUE porcuepine <[email protected]>
  • Loading branch information
mpvl committed Dec 9, 2024
1 parent 9b61fc0 commit 8aa5769
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions internal/core/adt/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,10 @@ func OpenNodeGraph(title, path, code, out, graph string) {
// and all its dependencies that have not completed processing.
// DO NOT DELETE: this is used to insert during debugging of the evaluator
// to inspect a node.
func openDebugGraph(ctx *OpContext, v *Vertex, name string) {
func openDebugGraph(ctx *OpContext, cc *closeContext, name string) {
v := cc.src
graph, _ := CreateMermaidGraph(ctx, v, true)
path := filepath.Join(".debug", "TestX", name)
path := filepath.Join(".debug", "TestX", name, fmt.Sprintf("%p", cc))
OpenNodeGraph(name, path, "in", "out", graph)
}

Expand Down
2 changes: 1 addition & 1 deletion internal/core/adt/fields.go
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ func (c *closeContext) incDependent(ctx *OpContext, kind depKind, dependant *clo
debug = c.addDependent(ctx, kind, dependant)

if c.done {
openDebugGraph(ctx, c.src, "incDependent: already checked")
openDebugGraph(ctx, c, "incDependent: already checked")

panic(fmt.Sprintf("incDependent: already closed: %p", c))
}
Expand Down

0 comments on commit 8aa5769

Please sign in to comment.