def search.first

bolt@1.27.0.0 · src/rules/correctness/pick.bend:247

import bolt@1.27.0.0/src/rules/correctness/pick.bend as Pick
import Base
import bolt@1.27.0.0/src/syntax/tree.bend as Tree

247# the first statement of the chain that reads xx, the chain's end (NNil)
248# when none does; hit: prev, the one before the chain, did
249def search.first(nn: Tree.Node, +xx: String, prev: Tree.Node, hit: Bool) -> Tree.Node:
250  match nn:
251    case Tree.NCons{+h, t}:
252      match hit:
253        case True{}:
254          prev
255        case False{}:
256          search.first(t, xx, h, search.reads(h, xx))
257    case _other:
258      match hit:
259        case True{}:
260          prev
261        case False{}:
262          Tree.NNil{}

Uses (4)

Used by (1)