def aliases
bolt@1.27.0.0 · src/syntax/bind.bend:172
import bolt@1.27.0.0/src/syntax/bind.bend as Bind
import Base
import bolt@1.27.0.0/src/syntax/tree.bend as Tree
172
173def aliases(root: Tree.Node, +acc: List<&2, String>) -> List<&2, String>:
174 match root:
175 case Tree.NCons{Tree.Stmt{Tree.SImport{}, kids, body}, rest}:
176 +last = last_text(kids)
177 aliases(rest, Bool.pick(List<&2, String>, Bool.or(String.eq(last, "Base"), String.eq(last, "import")), acc, last <> acc))
178 case Tree.NCons{other, rest}:
179 aliases(rest, acc)
180 case other:
181 acc