Report a held arm with no hold as an internal error, and name readHeld as the hold
This commit is contained in:
@@ -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`.
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user