From d19c5d4719f9ff210ba814ca519f0359163dea19 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Mon, 28 Sep 2026 23:58:14 +0200 Subject: [PATCH] Make renderEdges panic on a node kind it does not handle, and drop the done round item --- graph.go | 6 ++++-- render.go | 1 + todo.md | 3 --- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/graph.go b/graph.go index 5eab557..d47e196 100644 --- a/graph.go +++ b/graph.go @@ -114,7 +114,7 @@ func (e renderEdge) reached() string { return "{" + e.label + "}" } -// renderEdges lists the children rendering n recurses into, mirroring expand: a +// renderEdges lists the children rendering n recurses into, mirroring render: a // choice's items, and a template's field/reference tokens plus its operands. A // folder renders nothing, so it has no edges. func renderEdges(n node) []renderEdge { @@ -155,8 +155,10 @@ func renderEdges(n node) []renderEdge { es = append(es, renderEdge{to: c.node, label: n.t.header[n.i]}) } return es - default: + case *folder, *nullItem: return nil + default: + panic(fmt.Sprintf("fejkdata: renderEdges has no case for node %T", n)) } } diff --git a/render.go b/render.go index 5fe866a..b3b776c 100644 --- a/render.go +++ b/render.go @@ -49,6 +49,7 @@ func descend(s *session, root node, segments []string, sc renderScope) (node, er // render evaluates a compiled node to a string. compile validates every node up // front, so rendering a compiled tree cannot fail. sc holds the reference draws the // render shares; each repeat iteration renders over a hold set of its own. +// renderEdges mirrors this switch for the fences, so a new node kind goes in both. func render(s *session, n node, sc renderScope) string { switch n := n.(type) { case *choice: diff --git a/todo.md b/todo.md index 25716c2..a295900 100644 --- a/todo.md +++ b/todo.md @@ -23,9 +23,6 @@ Shape 5.8, Self-sufficiency 5.7), every seat capped by Locality, all nine naming This round, in order: -- Make `renderEdges` panic on a node it does not handle, as `render` does: its - `default: return nil` silently exempts a new node kind from every fence, and nothing - at `expand` says `renderEdges` mirrors it. - Carry the arm on `renderEdge` so `graph.go`, `drawfence.go` and `holdfence.go` stop re-parsing `label` through `splitArm`, whose key differs before and after link. - Give `pathCover` a doc comment and say in each path walk's comment how it differs from