def binder.go

bolt@1.27.0.0 · src/syntax/bind.bend:955

import bolt@1.27.0.0/src/syntax/bind.bend as Bind
import Base

955# the binder at a position (a use's target, or the binder itself); hit: the
956# one before binds was, so the search stops there
957def binder.go(binds: List<&2, Bind>, +line: U32, +col: U32, hit: Maybe<&2, Bind>) -> Maybe<&2, Bind>:
958  match binds:
959    case Nil{}:
960      hit
961    case Con{Bind{name, +l, +c, kind, note}, rest}:
962      match hit:
963        case Some{x}:
964          Some{x}
965        case None{}:
966          +here = Bool.and(U32.is_eq(l, line), U32.is_eq(c, col))
967          binder.go(rest, line, col, Bool.pick(Maybe<&2, Bind>, here, Some{Bind{name, l, c, kind, note}}, None{}))

Uses (7)

Used by (1)