Name the pin set's inline array and entered's flag apart from pins, and file the draw half of the pin model as its own item

This commit is contained in:
2026-09-24 09:54:05 +02:00
committed by Lillem4n
parent 30a39916b6
commit 00e6b7d357
4 changed files with 19 additions and 18 deletions
+1 -1
View File
@@ -95,7 +95,7 @@ func vocabulary(t *testing.T, files []*ast.File) string {
} }
// declaredSymbols is every name the package declares at the top level, a method and // declaredSymbols is every name the package declares at the top level, a method and
// a struct field keyed under its type: hold.pin, tableRead.whole. // a struct field keyed under its type: pinSet.pin, tableRead.whole.
func declaredSymbols(files []*ast.File) map[string]bool { func declaredSymbols(files []*ast.File) map[string]bool {
names := declaredFuncs(files) names := declaredFuncs(files)
for _, f := range files { for _, f := range files {
+1 -1
View File
@@ -229,7 +229,7 @@ func (w *drawWalk) walk(n node, at drawAt) {
} }
for _, e := range renderEdges(n) { for _, e := range renderEdges(n) {
if cell, isCell := e.to.(*template); isCell && cell.cellOf != nil { if cell, isCell := e.to.(*template); isCell && cell.cellOf != nil {
if at.alt.excludes(cell) { if at.alt.clash(cell.cellOf, cell.cellRow) != nil {
continue continue
} }
in := at in := at
+9 -12
View File
@@ -16,14 +16,14 @@ type tablePin struct {
// pinSet is the rows of tables fixed so far: by a render, by a path read replayed at load, and by // pinSet is the rows of tables fixed so far: by a render, by a path read replayed at load, and by
// a fence walk over the rows a render can enter, which also holds a row rendered whole, alone. // a fence walk over the rows a render can enter, which also holds a row rendered whole, alone.
type pinSet struct { type pinSet struct {
pins [8]tablePin // inline, so a render over a country's five-deep geo tree stays off the heap inline [8]tablePin // sized so a render over a country's five-deep geo tree stays off the heap
n int n int
spill map[*table]int spill map[*table]int
} }
// pinned is the row pinned for t, if any. // pinned is the row pinned for t, if any.
func (p *pinSet) pinned(t *table) (int, bool) { func (p *pinSet) pinned(t *table) (int, bool) {
for _, q := range p.pins[:p.n] { for _, q := range p.inline[:p.n] {
if q.t == t { if q.t == t {
return q.row, true return q.row, true
} }
@@ -43,8 +43,8 @@ func (p *pinSet) mustRow(t *table) int {
// add pins row r of t alone. // add pins row r of t alone.
func (p *pinSet) add(t *table, r int) { func (p *pinSet) add(t *table, r int) {
if p.n < len(p.pins) { if p.n < len(p.inline) {
p.pins[p.n] = tablePin{t, r} p.inline[p.n] = tablePin{t, r}
p.n++ p.n++
return return
} }
@@ -70,7 +70,7 @@ func (p *pinSet) pin(t *table, r int) {
// each calls fn for every pinned row, in pin order, the spilled ones by table name. // each calls fn for every pinned row, in pin order, the spilled ones by table name.
func (p *pinSet) each(fn func(t *table, r int)) { func (p *pinSet) each(fn func(t *table, r int)) {
for _, q := range p.pins[:p.n] { for _, q := range p.inline[:p.n] {
fn(q.t, q.row) fn(q.t, q.row)
} }
spilled := make([]*table, 0, len(p.spill)) spilled := make([]*table, 0, len(p.spill))
@@ -171,10 +171,10 @@ func (p pinSet) clone() pinSet {
// entered is p with row r of t: pinned where the render pins it, alone where the render draws it // entered is p with row r of t: pinned where the render pins it, alone where the render draws it
// to render whole. p is left as it was, since a fence walk branches. // to render whole. p is left as it was, since a fence walk branches.
func (p pinSet) entered(t *table, r int, pins bool) pinSet { func (p pinSet) entered(t *table, r int, pinsAncestors bool) pinSet {
p = p.clone() p = p.clone()
switch _, in := p.pinned(t); { switch _, in := p.pinned(t); {
case pins: case pinsAncestors:
p.pin(t, r) p.pin(t, r)
case !in: case !in:
p.add(t, r) p.add(t, r)
@@ -182,9 +182,6 @@ func (p pinSet) entered(t *table, r int, pins bool) pinSet {
return p return p
} }
// excludes reports whether a cell's row cannot render with the rows pinned.
func (p *pinSet) excludes(cell *template) bool { return p.clash(cell.cellOf, cell.cellRow) != nil }
// key spells the set for a map, by the tables' identities in path order. // key spells the set for a map, by the tables' identities in path order.
func (p *pinSet) key() string { func (p *pinSet) key() string {
var pins []tablePin var pins []tablePin
+8 -4
View File
@@ -43,10 +43,14 @@ This round, in order:
decided by `indexOutside(body, '(')` in two of them and by `funcCall` in the rest. decided by `indexOutside(body, '(')` in two of them and by `funcCall` in the rest.
- Name `pathWalk`'s modes: render, probe, check and cover are chosen today by which - Name `pathWalk`'s modes: render, probe, check and cover are chosen today by which
callbacks are nil and whether its session is, and `walkChoice` returns `nil, nil` where callbacks are nil and whether its session is, and `walkChoice` returns `nil, nil` where
none is set. Have the check mode report the tables a read draws, so `tableRead.drawn` none is set. The mode may live in `pathWalk`; the session may not, since beside `pins`
and `entered`'s `pins` flag come from the walk rather than a second copy of it moves the hold maps to the heap.
`walkTable`'s draw condition and `rowOf`'s ancestor rule. The mode may live in `pathWalk`; the session may not, since beside `pins` it - Have the check mode report the tables a read draws, so `tableRead.drawn` and
moves the hold maps to the heap. `entered`'s `pinsAncestors` flag stop restating `walkTable`'s draw condition and
`rowOf`'s ancestor rule: a change to how a render draws rows still leaves the fence
proving the old rule. Hold a row rendered whole in `drawAt` beside `drawn`, so
`pinSet` holds only what `pin` pins and `alternatives` needs no exception. Needs the
item above.
- Register a transform once: `transforms` restates the `lowercase`, `uppercase` and - Register a transform once: `transforms` restates the `lowercase`, `uppercase` and
`ascii` entries in `builtins`, and `valueProof.template` classifies by the first while `ascii` entries in `builtins`, and `valueProof.template` classifies by the first while
render calls the second. Derive the numeric builtins `valueProof.template` lists in render calls the second. Derive the numeric builtins `valueProof.template` lists in