def aliases

bolt@1.27.0.0 · src/syntax/outline.bend:588

import bolt@1.27.0.0/src/syntax/outline.bend as Outline
import Base

588# the import aliases that start with prefix (`import Base` has none)
589def aliases(items: List<&2, Item>, +prefix: String) -> List<&2, Item>:
590  match items:
591    case Nil{}:
592      Nil{}
593    case Con{Item{+k, +nm, l, s, d, +p}, t}:
594      +rest = aliases(t, prefix)
595      Bool.pick(List<&2, Item>,
596        Bool.and(Bool.and(is_import(k), String.starts_with(nm, prefix)), Bool.not(String.eq(nm, p))),
597        Item{k, nm, l, s, d, p} <> rest, rest)

Uses (9)

Used by (1)