def arms

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

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/rules/tokens.bend as T

105# a match's arms in order, against the widest n+p arm above each
106def arms(body: Tree.Node, +wide: Maybe<&2, Wide>, +path: String) -> List<&2, F.Finding>:
107  match body:
108    case Tree.NCons{Tree.Stmt{Tree.SCase{}, kids, b}, rest}:
109      +a = arm(T.pattern(kids))
110      verdict(wide, a, path, arms(rest, widen(wide, a), path))
111    case Tree.NCons{h, rest}:
112      arms(rest, wide, path)
113    case other:
114      Nil{}

Uses (11)

Used by (1)