def defs
bend-lint-rules@0.2.0.0 · performance/eager_branch.bend:153
import bend-lint-rules@0.2.0.0/performance/eager_branch.bend as EagerBranch
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
153def defs(
154 nodes: List<&2, Lint.Node>,
155 +costly: Set(),
156 out: List<&2, Lint.Finding>
157) -> List<&2, Lint.Finding>:
158 match nodes:
159 case Nil{}:
160 List.reverse(&2, Lint.Finding, out)
161 case Con{Lint.Node{Lint.Definition{+t, u}, n, s, k, f}, rest}:
162 defs(
163 rest,
164 costly,
165 Lists.onto(
166 &2,
167 Lint.Finding,
168 Lint.visit(
169 ~Owner,
170 ~Lint.Finding,
171 ~visit,
172 Owner{costly, t},
173 [Lint.Node{Lint.Definition{t, u}, n, s, k, f}]
174 ),
175 out
176 )
177 )
178 case Con{node, rest}:
179 defs(rest, costly, out)