DeepCallInFork.is_tail: 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 32-51 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=32&end_line=51 import Base import bend-lint-api@0.2.0.0/linter/lint.bend as Lint # Whether the node below `path` is in a tail position, if it ends the node above it (`ends`): the body of a definition # or a case, or the rest of a block after its lets, through annotations. def is_tail(path: List<&2, Lint.Above>, ends: Bool) -> Bool: match path ends: case _ False{}: False{} case Con{Lint.Above{Lint.Node{Lint.Body{}, n, s, k, f}, at}, rest} True{}: True{} case Con{Lint.Above{Lint.Node{Lint.Case{}, n, s, k, f}, at}, rest} True{}: is_tail(rest, True{}) case Con{Lint.Above{Lint.Node{Lint.Match{}, n, s, k, f}, at}, rest} True{}: is_tail(rest, True{}) case Con{Lint.Above{Lint.Node{Lint.Annotation{}, n, s, k, f}, at}, rest} True{}: is_tail(rest, True{}) case Con{Lint.Above{Lint.Node{Lint.Destructure{q}, n, s, kids, f}, at}, rest} True{}: is_tail(rest, is_last(kids, at)) case Con{Lint.Above{Lint.Node{Lint.Let{}, n, s, kids, f}, at}, rest} True{}: is_tail(rest, is_last(kids, at)) case _ _: False{} Uses (6): 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=bend-lint-api@0.2.0.0/linter/lint.bend&name=Above 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=is_last