Split walkPath's four modes into walkers of their own, sharing how a path steps

This commit is contained in:
2026-09-28 00:19:43 +02:00
committed by Lillem4n
parent 9126e0e07d
commit 94eb7aa81f
7 changed files with 261 additions and 187 deletions
+2 -3
View File
@@ -44,11 +44,10 @@ func (f *Generator) Fake(path string) (string, error) {
// every call.
func descend(s *session, root node, segments []string, sc renderScope) (node, error) {
// Walked once without drawing first, so a path that fails moves no seeded stream.
var probe pinSet
if _, err := walkPath(root, segments, pathWalk{mode: walkProbe, pins: &probe}); err != nil {
if _, err := (&probeWalk{}).walk(root, segments); err != nil {
return nil, err
}
return drawPath(root, segments, "", &sc.hold().pins, &pathDraws{s: s}), nil
return drawPath(root, segments, "", &renderWalk{s: s, pins: &sc.hold().pins}), nil
}
// render evaluates a compiled node to a string. compile validates every node up