Compile each path's steps, leaves and cover once at link, deleting pathCover, coverPath and pathLeaves

This commit is contained in:
2026-09-30 17:09:50 +02:00
committed by Lillem4n
parent 0f58784a1b
commit 6b9755b3ef
10 changed files with 149 additions and 103 deletions
+1 -14
View File
@@ -131,11 +131,7 @@ func renderEdges(n node) []renderEdge {
case *template:
var es []renderEdge
add := func(a arm, operand string) {
c := n.head(a.head)
if c == nil {
return
}
for _, leaf := range pathLeaves(c, a.tail) {
for _, leaf := range a.leaves {
es = append(es, renderEdge{leaf, a.spelling, a, operand})
}
}
@@ -165,15 +161,6 @@ func renderEdges(n node) []renderEdge {
}
}
// pathLeaves lists what a token's dotted tail renders: a choice on the way
// contributes every variant, since any of them may be the one drawn. checkPath has
// already proved the tail resolves in every variant.
func pathLeaves(n node, tail []string) []node {
w := &pathCheck{tail: tail}
_, _ = w.run(n)
return w.leaves
}
type renderCounts map[node]int
func (m renderCounts) renderCount(n node) int {