Make renderEdges panic on a node kind it does not handle, and drop the done round item

This commit is contained in:
2026-09-28 23:58:14 +02:00
committed by Lillem4n
parent 446a3f98d6
commit d19c5d4719
3 changed files with 5 additions and 5 deletions
+4 -2
View File
@@ -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))
}
}
+1
View File
@@ -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:
-3
View File
@@ -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