def visit

bolt@1.27.0.0 · src/rules/pedantic/rewalk.bend:871

import bolt@1.27.0.0/src/rules/pedantic/rewalk.bend as Rewalk
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

871# each case arm on its own, so two arms are not one path
872def visit(nn: Tree.Node, +self: String, +lp: List<&2, String>, +path: String) -> List<&2, F.Finding>:
873  match nn:
874    case Tree.NCons{Tree.Stmt{Tree.SCase{}, kids, +body}, rest}:
875      +here = local(body, self, lp, path)
876      List.concat(&2, F.Finding, [here, visit(body, self, lp, path), visit(rest, self, lp, path)])
877    case Tree.NCons{Tree.Stmt{kind, +kids, +body}, rest}:
878      List.concat(&2, F.Finding, [visit(kids, self, lp, path), visit(body, self, lp, path),
879        visit(rest, self, lp, path)])
880    case Tree.NCons{Tree.Group{open, +kids, close}, rest}:
881      List.concat(&2, F.Finding, [visit(kids, self, lp, path), visit(rest, self, lp, path)])
882    case Tree.NCons{h, rest}:
883      visit(rest, self, lp, path)
884    case other:
885      Nil{}

Uses (7)

Used by (1)