Delete the doc lines the 2026-10-07 panel read as restating their code, and say what gatherFields' index is
This commit is contained in:
@@ -96,7 +96,6 @@ func siteIn(dir []string, in *folder, name string) categorySite {
|
||||
return categorySite{dir: dir, path: categoryPath(dir, name), in: in, n: in.children[name]}
|
||||
}
|
||||
|
||||
// categoryPath is the dot path of the category name in the folder dir.
|
||||
func categoryPath(dir []string, name string) string { return join(strings.Join(dir, "."), name) }
|
||||
|
||||
func siteNodes(sites []categorySite) nodeSet {
|
||||
|
||||
@@ -43,7 +43,6 @@ func (env renderEnv) at(n node, pins *pinSet) renderEnv {
|
||||
return env
|
||||
}
|
||||
|
||||
// rowOf is the row of t its columns render from.
|
||||
func (env renderEnv) rowOf(t *table) int {
|
||||
if env.row.t != t {
|
||||
panic(invariant.Broken("a column of %s renders in an env holding no row of it", t.rows.Segment()))
|
||||
|
||||
@@ -93,7 +93,6 @@ func New(opts ...Option) (*Generator, error) {
|
||||
return &Generator{drawState: drawstate.New(seed), root: root}, nil
|
||||
}
|
||||
|
||||
// load is the tree New starts from.
|
||||
// docs/decisions.md#with-only-the-shipped-set-a-category-loads-on-the-first-call-reaching-it-beside-a---data-path-every-category-loads-in-new
|
||||
func (c config) load() (folder, error) {
|
||||
if c.shipped && len(c.sources) == 0 {
|
||||
|
||||
@@ -41,7 +41,6 @@ type namedNode struct {
|
||||
line int // a table cell's line in its rows file, else 0
|
||||
}
|
||||
|
||||
// labelIn is c's label inside the node labelled label.
|
||||
func (c namedNode) labelIn(label string) string {
|
||||
if c.line > 0 {
|
||||
return fmt.Sprintf("%s, line %d", label, c.line)
|
||||
|
||||
@@ -100,7 +100,6 @@ func (p *Pins[O]) PinRow(t *Table[O], r int) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Select pins the row of t that sel names, and returns it.
|
||||
func (p *Pins[O]) Select(t *Table[O], sel string) (int, error) {
|
||||
r, err := t.find(sel, p)
|
||||
if err != nil {
|
||||
|
||||
@@ -99,7 +99,6 @@ func bindNames(root node) error {
|
||||
return checkEveryNameRead(scopes, read)
|
||||
}
|
||||
|
||||
// checkEveryNameRead refuses a binding of scopes that nothing reads.
|
||||
func checkEveryNameRead(scopes []*nameScope, read map[*nameBinding]bool) error {
|
||||
for _, sc := range scopes {
|
||||
for _, b := range sc.order {
|
||||
@@ -111,7 +110,6 @@ func checkEveryNameRead(scopes []*nameScope, read map[*nameBinding]bool) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindAll binds every name t's tokens bind.
|
||||
func (sc *nameScope) bindAll(t *template, inChoice bool, where string) error {
|
||||
for _, tok := range t.tokens {
|
||||
if tok.Kind != grammar.NameBind {
|
||||
|
||||
@@ -365,7 +365,6 @@ func readOptions(m map[string]any, pos position) (templateOptions, error) {
|
||||
return o, nil
|
||||
}
|
||||
|
||||
// compileFields compiles every non-option key of a template object.
|
||||
func compileFields(m map[string]any, pos position) (map[string]node, error) {
|
||||
fields := make(map[string]node, len(m))
|
||||
for _, k := range sortedNames(m) {
|
||||
|
||||
@@ -46,7 +46,6 @@ func descend(s *drawstate.State, root node, segments []string) (node, pinSet, er
|
||||
return n, *leafPins, nil
|
||||
}
|
||||
|
||||
// renderOnce renders n as one render, over frames of its own.
|
||||
func renderOnce(s *drawstate.State, n node) string {
|
||||
var frames frameStack
|
||||
return render(s, n, renderEnv{frames: &frames})
|
||||
|
||||
@@ -32,7 +32,6 @@ func resolveCategoryTemplates(sites []categorySite, root map[string]node) error
|
||||
return resolveTemplates(ts, root)
|
||||
}
|
||||
|
||||
// resolveInlineTemplates resolves the templates of an inline node against the loaded tree.
|
||||
func resolveInlineTemplates(nodes nodeSet, root map[string]node) error {
|
||||
var ts []templateSite
|
||||
if err := nodes(func(label string, n node) error {
|
||||
@@ -134,7 +133,6 @@ func addressedKeys(ts []templateSite, targets map[*nameBinding]nameTarget) map[*
|
||||
return keys
|
||||
}
|
||||
|
||||
// nameUses is every read of each name in ts.
|
||||
func nameUses(ts []templateSite) map[*nameBinding][]nameUse {
|
||||
uses := map[*nameBinding][]nameUse{}
|
||||
for _, s := range ts {
|
||||
|
||||
@@ -127,7 +127,7 @@ 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)
|
||||
}
|
||||
|
||||
// t sits at index within c.typ.
|
||||
// index is the field index path, as reflect's FieldByIndex takes, from c.typ to t.
|
||||
func (c *structFields) gatherFields(t reflect.Type, index []int) error {
|
||||
for i := 0; i < t.NumField(); i++ {
|
||||
sf := t.Field(i)
|
||||
|
||||
Reference in New Issue
Block a user