def records
bend-lint-rules@0.2.0.0 · performance/template_value_field.bend:49
import bend-lint-rules@0.2.0.0/performance/template_value_field.bend as TemplateValueField
import Base
import bend-lint-api@0.2.0.0/linter/lint.bend as Lint
import bend-lint-api@0.2.0.0/shared/lists.bend as Lists
49
50
51def records(nodes: List<&2, Lint.Node>, out: List<&2, String>) -> List<&2, String>:
52 match nodes:
53 case Nil{}:
54 out
55 case Con{Lint.Node{Lint.Datatype{t}, n, s, kids, f}, rest}:
56 records(
57 rest,
58 Lists.push(
59 String,
60 Lists.when(String, Lint.fold(~Unit, ~Bool, ~records.step, Unit{}, kids, False{}), t),
61 out
62 )
63 )
64 case Con{node, rest}:
65 records(rest, out)