def walk.step
bend-lint-pack@0.1.1.0 · complexity/cognitive.bend:53
import bend-lint-pack@0.1.1.0/complexity/cognitive.bend as Cognitive
import Base
import bend-lint-pack@0.1.1.0/vendor/lint.bend as Lint
53def walk.step(
54 is_mat: Bool,
55 is_ann: Bool,
56 children: List<&2, Lint.Node>,
57 +depth: U32,
58 +chain: Bool,
59 total: U32
60) -> IO(U32):
61 match is_mat is_ann:
62 case True{} _:
63 walk.arms(
64 children,
65 depth,
66 True{},
67 U32.add(total, Bool.pick(U32, chain, 0, U32.add(depth, 1)))
68 )
69 case False{} True{}:
70 walk.all(children, depth, chain, total)
71 case False{} False{}:
72 walk.all(children, Bool.pick(U32, chain, U32.add(depth, 1), depth), False{}, total)