From 8aa57696fdb3f65a8ca3a02c0fb2bd9150d44bf2 Mon Sep 17 00:00:00 2001 From: Marcel van Lohuizen Date: Sat, 7 Dec 2024 16:00:02 +0100 Subject: [PATCH] internal/core/adt: pass closeContext to openDebugGraph 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 Change-Id: I8d973b9b90998d2be754371d6ab267c6ddabb12d Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1205362 TryBot-Result: CUEcueckoo Reviewed-by: Matthew Sackman Unity-Result: CUE porcuepine --- internal/core/adt/debug.go | 5 +++-- internal/core/adt/fields.go | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/core/adt/debug.go b/internal/core/adt/debug.go index 3e0d730d181..24e6609919f 100644 --- a/internal/core/adt/debug.go +++ b/internal/core/adt/debug.go @@ -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) } diff --git a/internal/core/adt/fields.go b/internal/core/adt/fields.go index b877763c75e..7d94f269465 100644 --- a/internal/core/adt/fields.go +++ b/internal/core/adt/fields.go @@ -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)) }