def Program.defs.file

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

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

941# The definitions among a file's nodes, by the name the check gives them, onto `out`.
942def Program.defs.file(
943  nodes: List<&2, Node>,
944  out: Map<&2, Maybe<&2, Def>>
945) -> Map<&2, Maybe<&2, Def>>:
946  match nodes:
947    case Nil{}:
948      out
949    case Con{Node{Definition{+t, u}, n, s, +kids, f}, rest}:
950      Program.defs.file(
951        rest,
952        Map.set(
953          &2,
954          Maybe<&2, Def>,
955          out,
956          t,
957          Some{
958            Def{
959              t,
960              Def.params(kids, []),
961              forks(kids, False{}),
962              visit(~Unit, ~String, ~Def.called.visit, Unit{}, kids),
963              Def.returned(kids)
964            }
965          }
966        )
967      )
968    case Con{node, rest}:
969      Program.defs.file(rest, out)

Uses (15)

Used by (1)