Make great documentation goal 1.2, and plan the README's reorganisation and the nested-template gaps #33

Open
lilleman wants to merge 966 commits from worktree-todo-relative-dates-exact-counts into main
4 changed files with 10 additions and 9 deletions
Showing only changes of commit cfe8124cc3 - Show all commits
+1 -1
View File
@@ -218,7 +218,7 @@ func checkScope(s nodeScope) error {
// the walk. Its walks terminate only where nothing renders itself, so run it over a // the walk. Its walks terminate only where nothing renders itself, so run it over a
// loaded tree after checkNoCycles. // loaded tree after checkNoCycles.
func checkRenders(s nodeScope) error { func checkRenders(s nodeScope) error {
mem := reachMemo{} mem := renderCounts{}
if err := s(func(path string, n node) error { return repeatCheck(path, n, mem) }); err != nil { if err := s(func(path string, n node) error { return repeatCheck(path, n, mem) }); err != nil {
return err return err
} }
+3 -3
View File
@@ -169,9 +169,9 @@ func pathLeaves(n node, tail []string) []node {
return out return out
} }
type reachMemo map[node]int type renderCounts map[node]int
func (m reachMemo) renderCount(n node) int { func (m renderCounts) renderCount(n node) int {
if r, done := m[n]; done { if r, done := m[n]; done {
return r return r
} }
@@ -191,7 +191,7 @@ func (m reachMemo) renderCount(n node) int {
// repeatCheck bounds the renders a repeat multiplies to along any root-to-leaf // repeatCheck bounds the renders a repeat multiplies to along any root-to-leaf
// path, so nested repeats cannot build what one repeat may not. // path, so nested repeats cannot build what one repeat may not.
// docs/decisions.md#the-repeat-cap-bounds-renders-not-bytes // docs/decisions.md#the-repeat-cap-bounds-renders-not-bytes
func repeatCheck(path string, n node, mem reachMemo) error { func repeatCheck(path string, n node, mem renderCounts) error {
if t, ok := n.(*template); ok && t.repeat > 1 && mem.renderCount(n) > MaxRepeat { if t, ok := n.(*template); ok && t.repeat > 1 && mem.renderCount(n) > MaxRepeat {
return fmt.Errorf("%s: repeat %d multiplies to %d renders along one path, above the maximum %d", path, t.repeat, mem.renderCount(n), MaxRepeat) return fmt.Errorf("%s: repeat %d multiplies to %d renders along one path, above the maximum %d", path, t.repeat, mem.renderCount(n), MaxRepeat)
} }
+3 -3
View File
@@ -123,19 +123,19 @@ func (sc *structCompile) spend(label string) error {
return fmt.Errorf(`%s: the struct fields reach more than %d structs; leave a struct field unfilled with fake:"-"`, label, maxStructs) return fmt.Errorf(`%s: the struct fields reach more than %d structs; leave a struct field unfilled with fake:"-"`, label, maxStructs)
} }
// gatherFields gathers the fields of struct type t, which sits at index within c.t. // t sits at index within c.t.
func (c *structFields) gatherFields(t reflect.Type, index []int) error { func (c *structFields) gatherFields(t reflect.Type, index []int) error {
for i := 0; i < t.NumField(); i++ { for i := 0; i < t.NumField(); i++ {
sf := t.Field(i) sf := t.Field(i)
sf.Index = append(index[:len(index):len(index)], i) sf.Index = append(index[:len(index):len(index)], i)
if err := c.addField(sf); err != nil { if err := c.gatherField(sf); err != nil {
return err return err
} }
} }
return nil return nil
} }
func (c *structFields) addField(sf reflect.StructField) error { func (c *structFields) gatherField(sf reflect.StructField) error {
tag, tagged := sf.Tag.Lookup("fake") tag, tagged := sf.Tag.Lookup("fake")
elem := structOf(sf.Type) elem := structOf(sf.Type)
switch { switch {
+3 -2
View File
@@ -20,8 +20,9 @@ Self-sufficiency 5.6), every seat capped by Locality or Self-sufficiency.
This round, in order: This round, in order:
- Rename the shared names left that name two things, per the decision "One name, one - Rename the shared names left that name two things, per the decision "One name, one
meaning": judge each of `check`, `draw`, `drawn`, `head`, `key`, `name`, `named`, meaning": judge each of `check`, `children`, `column`, `columns`, `draw`, `drawn`,
`names`, `null`, `number`, `record` and `variant`. `fields`, `format`, `head`, `index`, `key`, `n`, `name`, `named`, `names`, `null`,
`number`, `op`, `reads`, `record`, `root`, `row`, `t`, `variant` and `whole`.
- Run the nine-seat panel again and file what it names here. - Run the nine-seat panel again and file what it names here.
### Data ### Data