See a path token's head when walking for cycles

This commit is contained in:
M
2026-08-29 13:12:23 +02:00
committed by lilleman-tw
parent d7c4f43135
commit b8da6fdbc0
2 changed files with 16 additions and 1 deletions
+4 -1
View File
@@ -190,7 +190,10 @@ func renderEdges(n node) []renderEdge {
case *template:
var es []renderEdge
for _, name := range append(fieldTokens(n.format), calcOperands(n.format)...) {
if c, ok := n.fields[name]; ok {
// A path token renders its head, so the edge is to the head — over-
// approximating the sub-field it descends to, which is what keeps the
// cycle walk conservative rather than blind.
if c, ok := n.fields[splitArm(name).key]; ok {
es = append(es, renderEdge{c, name})
}
}