def search.judge
bolt@1.27.0.0 · src/rules/correctness/pick.bend:220
import bolt@1.27.0.0/src/rules/correctness/pick.bend as Pick
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
220
221
222
223def search.judge(
224 ss: Tree.Node,
225 +xx: String,
226 +args: Tree.Node,
227 +ll: U32,
228 +cc: U32,
229 +name: String,
230 +path: String
231) -> List<&2, F.Finding>:
232 match ss:
233 case Tree.Stmt{_k, Tree.NCons{Tree.Leaf{Lex.Tok{_kt, +t, _lt, _ct}}, Tree.NCons{Tree.Group{Lex.Tok{_ko, +o, _lo,
234 _co}, +kids, _cl}, after}}, _body}:
235 +as = Calls.args(kids)
236 +cond = Calls.arg(as, 1n)
237 +yes = Calls.arg(as, 2n)
238 +no = Calls.arg(as, 3n)
239 +shape = Bool.and(Bool.and(String.eq(t, "Bool.pick"), String.eq(o, "(")), search.empty(after))
240 +only = Bool.and(Bool.not(Bool.or(search.reads(cond, xx), search.reads(yes, xx))), search.reads(no, xx))
241 Bool.pick(List<&2, F.Finding>,
242 Bool.and(Bool.and(shape, only), Bool.not(search.cheap(args, search.text(cond)))),
243 [search.cite(ll, cc, name, path, search.lone(no, xx))], [])
244 case _other:
245 []