Enter the ancestor rows the render pins into the walk's row set
This commit is contained in:
@@ -301,7 +301,8 @@ type drawAt struct {
|
|||||||
|
|
||||||
// rowSet is the rows a walk entered, one per table: only one row of a table renders, so reads in
|
// rowSet is the rows a walk entered, one per table: only one row of a table renders, so reads in
|
||||||
// two rows of one table never meet, while reads in one row, across its columns and whatever they
|
// two rows of one table never meet, while reads in one row, across its columns and whatever they
|
||||||
// reach, do.
|
// reach, do. It simulates what the render pins: enter is (*draws).pin and rowOf is its pinned, and
|
||||||
|
// TestRowSetSimulatesPinning holds the two to one answer.
|
||||||
type rowSet []tablePin
|
type rowSet []tablePin
|
||||||
|
|
||||||
func (s rowSet) rowOf(t *table) (int, bool) {
|
func (s rowSet) rowOf(t *table) (int, bool) {
|
||||||
@@ -313,12 +314,23 @@ func (s rowSet) rowOf(t *table) (int, bool) {
|
|||||||
return 0, false
|
return 0, false
|
||||||
}
|
}
|
||||||
|
|
||||||
// enter is s with row r of t, where t is not in it yet; the set is copied, since walks branch.
|
// enter is s with row r of t and the ancestor rows it links to, where t is not in it yet; the set
|
||||||
|
// is copied, since walks branch.
|
||||||
func (s rowSet) enter(t *table, r int) rowSet {
|
func (s rowSet) enter(t *table, r int) rowSet {
|
||||||
if _, in := s.rowOf(t); in {
|
if _, in := s.rowOf(t); in {
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
out := append(append(make(rowSet, 0, len(s)+1), s...), tablePin{t, r})
|
out := append(make(rowSet, 0, len(s)+1), s...)
|
||||||
|
for {
|
||||||
|
if _, in := out.rowOf(t); in {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
out = append(out, tablePin{t, r})
|
||||||
|
if t.parentT == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
t, r = t.parentT, t.parentRow(r)
|
||||||
|
}
|
||||||
sort.Slice(out, func(i, j int) bool { return out[i].t.category < out[j].t.category })
|
sort.Slice(out, func(i, j int) bool { return out[i].t.category < out[j].t.category })
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,10 +21,6 @@ name says whether a unit runs at `New` or at `Fake`.
|
|||||||
|
|
||||||
This round, in order:
|
This round, in order:
|
||||||
|
|
||||||
- State on `rowSet` that it simulates `(*draws).pin` and `rowOf`, and prove the two
|
|
||||||
agree with a test: the load-time walk reimplements the render-time pinning, nothing
|
|
||||||
catches them drifting, and the failure is data that loads and then renders a family
|
|
||||||
that disagrees.
|
|
||||||
- Put `draws` and its methods in one file: it is declared in `hold.go:262` and all
|
- Put `draws` and its methods in one file: it is declared in `hold.go:262` and all
|
||||||
eight of its methods sit in `family.go`, so a jump to the type lands where none of
|
eight of its methods sit in `family.go`, so a jump to the type lands where none of
|
||||||
the behaviour is.
|
the behaviour is.
|
||||||
|
|||||||
Reference in New Issue
Block a user