def Declarations.tops

bend-lint-api@0.2.0.0 · linter/lint.bend:747

import bend-lint-api@0.2.0.0/linter/lint.bend as Lint
import Base
import bend-lint-api@0.2.0.0/shared/tables.bend as Tables

747def Declarations.tops(
748  nodes: List<&2, Node>,
749  +sources: List<&2, Source>,
750  +globals: Map<&2, List<&2, Node>>,
751  +imported: Imported,
752  out: List<&2, Declaration>
753) -> List<&2, Declaration>:
754  match nodes:
755    case Nil{}:
756      out
757    case Con{+top, rest}:
758      Declarations.tops(
759        rest,
760        sources,
761        globals,
762        imported,
763        fold(
764          ~Uses,
765          ~List<&2, Declaration>,
766          ~Declarations.node,
767          Uses{
768            sources,
769            globals,
770            fold(
771              ~Unit,
772              ~Tables.Table<List<&2, Node>>,
773              ~Uses.binder,
774              Unit{},
775              [top],
776              Tables.TLeaf{None{}}
777            ),
778            imported
779          },
780          [top],
781          out
782        )
783      )

Uses (13)

Used by (1)