Pick.search.judge: def of bolt@1.27.0.0 Import: import bolt@1.27.0.0/src/rules/correctness/pick.bend as Pick Lines 220-245 of bolt@1.27.0.0/src/rules/correctness/pick.bend: https://jend.leeeet.dev/read.txt?path=bolt@1.27.0.0/src/rules/correctness/pick.bend&start_line=220&end_line=245 import Base import bolt@1.27.0.0/src/finding.bend as F import bolt@1.27.0.0/src/syntax/lex.bend as Lex import bolt@1.27.0.0/src/syntax/tree.bend as Tree import bolt@1.27.0.0/src/rules/calls.bend as Calls # the statement that reads the bound name first: a finding when it is a # `Bool.pick(..)` alone that reads the name only in its else branch, and the # self-call (its arguments args) holds no pick on the same condition def search.judge( ss: Tree.Node, +xx: String, +args: Tree.Node, +ll: U32, +cc: U32, +name: String, +path: String ) -> List<&2, F.Finding>: match ss: case Tree.Stmt{_k, Tree.NCons{Tree.Leaf{Lex.Tok{_kt, +t, _lt, _ct}}, Tree.NCons{Tree.Group{Lex.Tok{_ko, +o, _lo, _co}, +kids, _cl}, after}}, _body}: +as = Calls.args(kids) +cond = Calls.arg(as, 1n) +yes = Calls.arg(as, 2n) +no = Calls.arg(as, 3n) +shape = Bool.and(Bool.and(String.eq(t, "Bool.pick"), String.eq(o, "(")), search.empty(after)) +only = Bool.and(Bool.not(Bool.or(search.reads(cond, xx), search.reads(yes, xx))), search.reads(no, xx)) Bool.pick(List<&2, F.Finding>, Bool.and(Bool.and(shape, only), Bool.not(search.cheap(args, search.text(cond)))), [search.cite(ll, cc, name, path, search.lone(no, xx))], []) case _other: [] Uses (19): 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.not 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=bolt@1.27.0.0/src/finding.bend&name=Finding https://jend.leeeet.dev/definition.txt?path=bolt@1.27.0.0/src/rules/calls.bend&name=arg https://jend.leeeet.dev/definition.txt?path=bolt@1.27.0.0/src/rules/calls.bend&name=args https://jend.leeeet.dev/definition.txt?path=bolt@1.27.0.0/src/rules/correctness/pick.bend&name=search.cheap https://jend.leeeet.dev/definition.txt?path=bolt@1.27.0.0/src/rules/correctness/pick.bend&name=search.cite https://jend.leeeet.dev/definition.txt?path=bolt@1.27.0.0/src/rules/correctness/pick.bend&name=search.empty https://jend.leeeet.dev/definition.txt?path=bolt@1.27.0.0/src/rules/correctness/pick.bend&name=search.lone https://jend.leeeet.dev/definition.txt?path=bolt@1.27.0.0/src/rules/correctness/pick.bend&name=search.reads https://jend.leeeet.dev/definition.txt?path=bolt@1.27.0.0/src/rules/correctness/pick.bend&name=search.text https://jend.leeeet.dev/definition.txt?path=bolt@1.27.0.0/src/syntax/lex.bend&name=Tok https://jend.leeeet.dev/definition.txt?path=bolt@1.27.0.0/src/syntax/tree.bend&name=Node