From 58e26c6d6bb5f45c5bdc232e92e82ed1c3109967 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Tue, 29 Sep 2026 03:43:11 +0200 Subject: [PATCH] Report a held arm with no hold as an internal error, and name readHeld as the hold --- doc.go | 2 +- hold.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/doc.go b/doc.go index b5f8528..efe7a17 100644 --- a/doc.go +++ b/doc.go @@ -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`. diff --git a/hold.go b/hold.go index 07e4239..d275c7f 100644 --- a/hold.go +++ b/hold.go @@ -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) }