def visit.go
bend-lint-api@0.2.0.0 · linter/lint.bend:304
import bend-lint-api@0.2.0.0/linter/lint.bend as Lint
import Base
import bend-lint-api@0.2.0.0/shared/lists.bend as Lists
304def visit.go(
305 ~C: Data,
306 ~A: Data,
307 ~f: @+c: C -> @+path: List<&2, Above> -> @+node: Node -> List<&2, A>,
308 nodes: List<&2, Node>,
309 +c: C,
310 +up: List<&2, Above>,
311 +parent: Maybe<&2, Node>,
312 +at: U32,
313 out: List<&2, A>
314) -> List<&2, A>:
315 match nodes:
316 case Nil{}:
317 out
318 case Con{Node{syntax, name, span, +kids, facts}, rest}:
319 +node = {Node{syntax, name, span, kids, facts}: Node}
320 +path = Above.of(parent, at, up)
321 visit.go(
322 ~C,
323 ~A,
324 ~f,
325 rest,
326 c,
327 up,
328 parent,
329 (at + 1: U32),
330 visit.go(~C, ~A, ~f, kids, c, path, Some{node}, 0, Lists.onto(&2, A, f(c, path, node), out))
331 )