DeepCallInFork.leads: def of bend-lint-rules@0.2.0.0 Import: import bend-lint-rules@0.2.0.0/performance/deep_call_in_fork.bend as DeepCallInFork Lines 131-148 of bend-lint-rules@0.2.0.0/performance/deep_call_in_fork.bend: https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.0.0/performance/deep_call_in_fork.bend&start_line=131&end_line=148 import Base import bend-lint-api@0.2.0.0/linter/lint.bend as Lint # Whether a let leads to a fork: it is one (it binds `many` names), or it binds one (`one`), and the last of `nodes`, # the rest of its block, is a let that leads to one. The values of these lets are what a fork runs, or what runs just # before it. def leads(nodes: List<&2, Lint.Node>, many: Bool, one: Bool) -> Bool: match nodes many one: case _ True{} _: True{} case _ False{} False{}: False{} case Con{Lint.Node{Lint.Destructure{q}, n, s, +kids, f}, Nil{}} False{} True{}: +count = binders(kids, 0n) leads(kids, Nat.is_gt(count, 1n), Nat.is_eq(count, 1n)) case Con{x, Nil{}} False{} True{}: False{} case Con{x, rest} False{} True{}: leads(rest, False{}, True{}) case Nil{} False{} True{}: False{} Uses (7): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.is_eq https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.is_gt https://jend.leeeet.dev/definition.txt?path=bend-lint-api@0.2.0.0/linter/lint.bend&name=Node https://jend.leeeet.dev/definition.txt?path=bend-lint-api@0.2.0.0/linter/lint.bend&name=Syntax https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/performance/deep_call_in_fork.bend&name=binders