Fix a render's fallback frame to its unnamed group, and draw a pick's references in draw groups of its own

This commit is contained in:
2026-10-03 02:12:24 +02:00
committed by Lillem4n
parent 30d18bf485
commit 4362905b82
6 changed files with 36 additions and 24 deletions
+14 -5
View File
@@ -219,10 +219,12 @@ func linkName(t *template, a *arm) error {
}
// namedPick is one draw of a name: the variant drawn at each level under it, the value each
// path through it read, keyed by the path from the name, and the table rows they pinned.
// path through it read, keyed by the path from the name, and the table rows they pinned; and the
// draw groups of the references read under it, so two names on one category are two picks of it.
type namedPick struct {
memo drawMemo
pins pinSet
refs renderDraws
}
// pickFrame is one render of a name scope: a pick per binding, each drawn on its first read.
@@ -299,15 +301,22 @@ func (sc renderScope) pickOf(b *nameBinding) *namedPick {
}
}
}
memo := sc.entry
if memo == nil {
memo = &sc.groupDraws().memo
return &sc.entryMemo().frameOf(b.scope).picks[b.index]
}
// entryMemo is the memo of the read that entered the category rendering, else the unnamed draw
// group's of the render: one memo for a render begun below a category's root, whatever draw group
// its templates name.
func (sc renderScope) entryMemo() *drawMemo {
if sc.entry != nil {
return sc.entry
}
return &memo.frameOf(b.scope).picks[b.index]
return &sc.draws.unnamed.memo
}
func readName(s *generatorState, sc renderScope, a arm) readValue {
p := sc.pickOf(a.bind)
sc.refs, sc.group = &p.refs, ""
return readPicked(s, p, a.bind.head, a.steps, a.levels, a.path, sc.entering(&p.memo))
}