def passes

bend-lint-rules@0.2.0.0 · performance/list_index_loop.bend:136

import bend-lint-rules@0.2.0.0/performance/list_index_loop.bend as ListIndexLoop
import Base
import bend-lint-api@0.2.0.0/linter/lint.bend as Lint

136# Whether a call of `target` among `nodes`, or under them, passes the binder `b` unchanged, or `found`.
137def passes(nodes: List<&2, Lint.Node>, +target: String, +b: U32, found: Bool) -> Bool:
138  match nodes found:
139    case _ True{}:
140      True{}
141    case Nil{} False{}:
142      False{}
143    case Con{
144      Lint.Node{
145        Lint.Application{},
146        n,
147        s,
148        Con{Lint.Node{Lint.Reference{t}, rn, rs, rk, rf}, +args},
149        f
150      },
151      rest
152    } False{}:
153      passes(rest, target, b, passes(args, target, b, is_passed.if(String.eq(t, target), args, b)))
154    case Con{Lint.Node{syntax, n, s, kids, f}, rest} False{}:
155      passes(rest, target, b, passes(kids, target, b, False{}))

Uses (8)

Used by (1)