Report a held arm with no hold as an internal error, and name readHeld as the hold

This commit is contained in:
2026-09-29 03:43:11 +02:00
committed by Lillem4n
parent a9ec8b3632
commit 58e26c6d6b
2 changed files with 4 additions and 1 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ package fejkdata
// start one each, `FakeStruct` one per record, and `expandAnew` one per
// iteration of a `template.repeat`.
// - hold — keeping one draw of a name, so every route to it reads that value:
// `formatOps.held`, `hold`, `groupHold`, `readField`.
// `formatOps.held`, `hold`, `groupHold`, `readHeld`.
// - draw group — reference draws held apart inside one render:
// `template.drawGroup` as the data spells it, `templateLink.drawGroupKey` as a
// render reads it, `holdSet`, `renderScope`.
+3
View File
@@ -41,6 +41,9 @@ func readField(s *session, t *template, held *hold, sc renderScope, a arm) readV
}
return readValue{text: render(s, t.head(a.key), sc)}
}
if held == nil {
panic(internalError("%q reads a name the expansion holds, with no hold to keep it in", a.spelling))
}
return readHeld(s, t, held, nil, sc, a)
}