def walk

bolt@1.27.0.0 · src/rules/correctness/arms.bend:125

import bolt@1.27.0.0/src/rules/correctness/arms.bend as Arms
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
import bolt@1.27.0.0/src/lazy/lazy.bend as Lazy

125# every statement, at any depth; a single-scrutinee match's arms are read
126def walk(nn: Tree.Node, +path: String) -> List<&2, F.Finding>:
127  match nn:
128    case Tree.NCons{Tree.Stmt{kind, kids, +body}, rest}:
129      +mine = Lazy.stop(List<&2, F.Finding>, Bool.not(single(kids)), [], _u => arms(body, None{}, path))
130      List.concat(&2, F.Finding, [mine, walk(body, path), walk(rest, path)])
131    case Tree.NCons{h, rest}:
132      walk(rest, path)
133    case other:
134      Nil{}

Uses (10)

Used by (1)