def walk

bolt@1.27.0.0 · src/rules/perf/strings.bend:100

import bolt@1.27.0.0/src/rules/perf/strings.bend as Strings
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

100# every statement, at any depth
101def walk(nn: Tree.Node, +path: String) -> List<&2, F.Finding>:
102  match nn:
103    case Tree.NCons{Tree.Stmt{kind, kids, +body}, rest}:
104      List.concat(&2, F.Finding, [on_stmt(kids, body, path), walk(body, path), walk(rest, path)])
105    case Tree.NCons{h, rest}:
106      walk(rest, path)
107    case other:
108      Nil{}

Uses (6)

Used by (1)