EagerBranch.eager: def of bend-lint-rules@0.2.0.0 Import: import bend-lint-rules@0.2.0.0/performance/eager_branch.bend as EagerBranch Lines 35-61 of bend-lint-rules@0.2.0.0/performance/eager_branch.bend: https://jend.leeeet.dev/read.txt?path=bend-lint-rules@0.2.0.0/performance/eager_branch.bend&start_line=35&end_line=61 import Base import bend-lint-api@0.2.0.0/linter/lint.bend as Lint # Functions # ========= # What an application with the nodes `kids` computes whether needed or not, as its node at `at` is one of its # arguments: "pick" for a value of Bool.pick, "&&" or "||" for their right side, "" for none. def eager(kids: List<&2, Lint.Node>, +at: U32) -> String: match kids: case Con{Lint.Node{Lint.Reference{t}, n, s, k, f}, Con{ty, Con{c, Con{x, Con{y, rest}}}}}: Bool.pick( String, String.eq(t, "Bool.pick") && (U32.is_eq(at, 3) || U32.is_eq(at, 4)), "pick", "" ) case Con{Lint.Node{Lint.Reference{+t}, n, s, k, f}, Con{left, Con{right, Nil{}}}}: Bool.pick( String, U32.is_eq(at, 2), Bool.pick( String, String.eq(t, "Bool.and"), "&&", Bool.pick(String, String.eq(t, "Bool.or"), "||", "") ), "" ) case _: "" Uses (10): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.and https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.or https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.pick 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=Base/base.bend&name=String.eq https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_eq 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