Correct and trim the comments around the path walks

This commit is contained in:
2026-09-28 00:43:20 +02:00
committed by Lillem4n
parent 79cacb2823
commit e9bb89f044
8 changed files with 23 additions and 32 deletions
+3 -7
View File
@@ -36,14 +36,10 @@ func (f *Generator) Fake(path string) (string, error) {
return render(f.rand, n, sc), nil
}
// descend walks named fields to the node a path names, pinning the table rows it
// selects or draws in sc. It is the one render-side step that can fail, because the
// path comes from the caller and may name a field or a row that does not exist. A
// choice consumes no segment, so the rest of the path must be one every variant
// carries before a variant is picked — a path that resolves at all resolves on
// every call.
// descend walks a caller's path to the node it names, pinning in sc the rows it
// selects or draws.
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.
// docs/decisions.md#a-path-is-walked-once-without-drawing-before-it-is-walked-for-real
if _, err := (&pathProbe{drawn: map[*table]bool{}}).walk(root, segments); err != nil {
return nil, err
}