def walk
bolt@1.27.0.0 · src/rules/perf/chars.bend:59
import bolt@1.27.0.0/src/rules/perf/chars.bend as Chars
import Base
import bolt@1.27.0.0/src/finding.bend as F
import bolt@1.27.0.0/src/syntax/tree.bend as Tree
59
60def walk(nn: Tree.Node, +path: String) -> List<&2, F.Finding>:
61 match nn:
62 case Tree.NCons{Tree.Stmt{kind, kids, +body}, rest}:
63 List.concat(&2, F.Finding, [on_stmt(kids, body, path), walk(body, path), walk(rest, path)])
64 case Tree.NCons{h, rest}:
65 walk(rest, path)
66 case other:
67 Nil{}