def ranged
bolt@1.27.0.0 · src/rules/digest.bend:222
import bolt@1.27.0.0/src/rules/digest.bend as Digest
import Base
import bolt@1.27.0.0/src/syntax/bind.bend as Bind
import bolt@1.27.0.0/src/syntax/outline.bend as Outline
import bolt@1.27.0.0/src/rules/imports.bend as Imports
222
223
224
225
226def ranged(
227 items: List<&2, Outline.Item>,
228 +us: List<&2, Bind.Use>,
229 +as: List<&2, Alias>,
230 +file: String,
231 +ps: List<&2, String>
232) -> List<&2, Top>:
233 match items:
234 case Nil{}:
235 Nil{}
236 case Con{Outline.Item{Outline.ICtor{}, name, line, sig, doc, path}, rest}:
237 ranged(rest, us, as, file, ps)
238 case Con{Outline.Item{Outline.IDef{}, +name, line, sig, doc, path}, +rest}:
239 +nx = next_line(rest)
240 cs = called(upto(us, nx), as, file)
241 +more = ranged(rest, past(us, nx), as, file, ps)
242 Bool.pick(List<&2, Top>, Imports.has(ps, name), more, Top{Outline.IDef{}, name, line, [], cs} <> more)
243 case Con{Outline.Item{Outline.IType{}, name, line, sig, doc, path}, +rest}:
244 +nx = next_line(rest)
245 Top{Outline.IType{}, name, line, ctors(rest), called(upto(us, nx), as, file)}
246 <> ranged(rest, past(us, nx), as, file, ps)
247 case Con{Outline.Item{kind, name, line, sig, doc, path}, +rest}:
248 ranged(rest, past(us, next_line(rest)), as, file, ps)