Answer architecture round 1: refuse a name read inside the field it binds, check every scope's cycles, build a column read in one pass, drop the implicit struct pick for names across tags, and state the fresh-draw rule once

This commit is contained in:
2026-10-05 09:39:18 +02:00
committed by Lillem4n
parent a45edf8fb5
commit 1a15a139c8
23 changed files with 257 additions and 230 deletions
+48
View File
@@ -0,0 +1,48 @@
package fejkdata
// readValue is what one read drew: its text, and whether it landed on a null.
type readValue struct {
text string
null bool
}
// renderScope 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 sc, and with it every
// render's frames, moves to the heap.
type renderScope struct {
frames *frameStack
row renderedRow
// base is the depth of the frame stack when the read rendering the category entered it,
// below which no frame is the category's.
base int
// pick is the named pick being rendered, nil outside one; pickKey is the path from the name
// to what renders.
pick *namedPick
pickKey string
}
type renderedRow struct {
t *table
index int
}
// at is the scope n, the leaf of a path that pinned its rows in pins, renders in: where n is a
// table's row or column, at the row pins holds for that table.
func (sc renderScope) at(n node, pins *pinSet) renderScope {
switch n := n.(type) {
case *tableRow:
sc.row = renderedRow{n.t, pins.mustRow(n.t)}
case *tableColumn:
sc.row = renderedRow{n.t, pins.mustRow(n.t)}
}
return sc
}
// rowOf is the row of t its columns render from.
func (sc renderScope) rowOf(t *table) int {
if sc.row.t != t {
panic(internalError("a column of %s renders in a scope holding no row of it", t.segment))
}
return sc.row.index
}