Hold a path's last level too, and reject an unfinished path

This commit is contained in:
M
2026-08-30 20:08:47 +02:00
committed by lilleman-tw
parent 8accca54b1
commit e05fed1190
2 changed files with 33 additions and 15 deletions
+6 -9
View File
@@ -191,17 +191,14 @@ func resolve(s *session, arms []arm, t *template, bound *draws) string {
}
// Walk the tail, holding the draw at every level the path passes through, so
// two paths sharing a prefix share every choice along it, not just the head.
// The last level is held too: another token may name it in full.
for i, seg := range a.tail {
if i < len(a.steps) {
held, drew := bound.variant[a.steps[i]]
if !drew {
held = drawn(s, child(n, seg))
bound.variant[a.steps[i]] = held
}
n = held
continue
held, drew := bound.variant[a.steps[i]]
if !drew {
held = drawn(s, child(n, seg))
bound.variant[a.steps[i]] = held
}
n = child(n, seg)
n = held
}
v := render(s, n)
bound.value[a.name] = v