def refresh.go

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

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

1026# each binder of an environment, outermost first, with the note its annotated
1027# twin carries, pushed onto acc (so acc ends innermost first again). cur is a
1028# cursor into binds that drops only binders before (tl, tc), the last one
1029# read: an environment's binders were pushed in source order, so each lookup
1030# picks up where the last stopped and binds is read once, not once per
1031# binder. A binder before the last one read starts the cursor over
1032def refresh.go(
1033  env: List<&2, Bind>,
1034  +binds: List<&2, Bind>,
1035  +cur: List<&2, Bind>,
1036  +tl: U32,
1037  +tc: U32,
1038  acc: List<&2, Bind>
1039) -> List<&2, Bind>:
1040  match env:
1041    case Nil{}:
1042      acc
1043    case Con{Bind{name, +l, +c, kind, note}, rest}:
1044      +start = Bool.pick(List<&2, Bind>, before(l, c, tl, tc), binds, cur)
1045      +from = seek(start, l, c, seek.stop(start, l, c))
1046      refresh.go(rest, binds, from, l, c, noted(seek.head(from, l, c), Bind{name, l, c, kind, note}) <> acc)

Uses (9)

Used by (1)