def has

bend-lint-rules@0.2.0.0 · performance/append_in_loop.bend:88

import bend-lint-rules@0.2.0.0/performance/append_in_loop.bend as AppendInLoop
import Base
import bend-lint-api@0.2.0.0/linter/lint.bend as Lint

88# Whether a variable the file writes, of the binder `b`, is among `nodes` or under them, or `found`.
89def has(nodes: List<&2, Lint.Node>, +b: U32, found: Bool) -> Bool:
90  match nodes found:
91    case _ True{}:
92      True{}
93    case Nil{} False{}:
94      False{}
95    case Con{Lint.Node{Lint.Variable{v}, n, Some{s}, k, f}, rest} False{}:
96      has(rest, b, U32.is_eq(v, b))
97    case Con{Lint.Node{syntax, n, s, kids, f}, rest} False{}:
98      has(rest, b, has(kids, b, False{}))

Uses (7)

Used by (1)