Make renderEdges panic on a node kind it does not handle, and drop the done round item
This commit is contained in:
@@ -114,7 +114,7 @@ func (e renderEdge) reached() string {
|
|||||||
return "{" + e.label + "}"
|
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
|
// choice's items, and a template's field/reference tokens plus its operands. A
|
||||||
// folder renders nothing, so it has no edges.
|
// folder renders nothing, so it has no edges.
|
||||||
func renderEdges(n node) []renderEdge {
|
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]})
|
es = append(es, renderEdge{to: c.node, label: n.t.header[n.i]})
|
||||||
}
|
}
|
||||||
return es
|
return es
|
||||||
default:
|
case *folder, *nullItem:
|
||||||
return nil
|
return nil
|
||||||
|
default:
|
||||||
|
panic(fmt.Sprintf("fejkdata: renderEdges has no case for node %T", n))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
// 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
|
// 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.
|
// 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 {
|
func render(s *session, n node, sc renderScope) string {
|
||||||
switch n := n.(type) {
|
switch n := n.(type) {
|
||||||
case *choice:
|
case *choice:
|
||||||
|
|||||||
@@ -23,9 +23,6 @@ Shape 5.8, Self-sufficiency 5.7), every seat capped by Locality, all nine naming
|
|||||||
|
|
||||||
This round, in order:
|
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
|
- 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.
|
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
|
- Give `pathCover` a doc comment and say in each path walk's comment how it differs from
|
||||||
|
|||||||
Reference in New Issue
Block a user