MissedFork.calls: def of bend-lint-rules@0.2.0.0 Import: import bend-lint-rules@0.2.0.0/performance/missed_fork.bend as MissedFork Lines 123-150 of bend-lint-rules@0.2.0.0/performance/missed_fork.bend: https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.0.0/performance/missed_fork.bend&start_line=123&end_line=150 import Base import bend-lint-api@0.2.0.0/linter/lint.bend as Lint # Where the calls of `target` among `nodes` and under them are (onto `out`, last first), in the expression they start: # a node that ends it starts another, and so does each argument of a choice (Bool.pick, Bool.and, Bool.or); a call # inside another call of `target` does not count: none does if `nodes` are the parts of one, or of a choice (`inside`). def calls( nodes: List<&2, Lint.Node>, +target: String, out: List<&2, Lint.Span>, inside: Bool ) -> List<&2, Lint.Span>: match nodes inside: case _ True{}: out case Nil{} False{}: out case Con{Lint.Node{Lint.Application{}, n, span, +kids, f}, rest} False{}: +call = calls.to(kids, target) calls( rest, target, calls(kids, target, called.at(call, span, out), call || is_choice(kids)), False{} ) case Con{Lint.Node{Lint.Construction{t}, n, s, kids, f}, rest} False{}: calls(rest, target, calls(kids, target, out, False{}), False{}) case Con{Lint.Node{Lint.Annotation{}, n, s, kids, f}, rest} False{}: calls(rest, target, calls(kids, target, out, False{}), False{}) case Con{node, rest} False{}: calls(rest, target, out, False{}) Uses (10): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.or https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String 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=Span 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/missed_fork.bend&name=called.at https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/performance/missed_fork.bend&name=calls.to https://jend.leeeet.dev/definition.txt?path=bend-lint-rules@0.2.0.0/performance/missed_fork.bend&name=is_choice