Compile each path's steps, leaves and cover once at link, deleting pathCover, coverPath and pathLeaves
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user