Move frameStack into env.go and the name steps of resolveTemplates into name.go, and hold a binding's target in a named field

This commit is contained in:
2026-10-07 02:08:38 +02:00
committed by Lillem4n
parent 63e985a53d
commit 097fae4cd2
6 changed files with 83 additions and 81 deletions
+15
View File
@@ -11,6 +11,21 @@ type readValue struct {
null bool
}
// frameStack is the frames of the name scopes rendering, innermost last. A render's env points
// at it, and a repeat iteration's shares it: holding the frames in a renderEnv would move every
// render's env to the heap.
type frameStack struct {
frames []*pickFrame
}
func (st *frameStack) push(f *pickFrame) int {
mark := len(st.frames)
st.frames = append(st.frames, f)
return mark
}
func (st *frameStack) pop(mark int) { st.frames = st.frames[:mark] }
// renderEnv is where a render reads: the frames of the name scopes rendering; and row, the row
// of the table rendering, which its columns read. It passes by value, and what is read from it
// reaches a map key, an interface or a func value only as a copy; else env, and with it every