def places

bend-lint-rules@0.2.0.0 · language/forward_reference.bend:37

import bend-lint-rules@0.2.0.0/language/forward_reference.bend as ForwardReference
import Base
import bend-lint-api@0.2.0.0/linter/lint.bend as Lint

37# Where each definition among `nodes`, the file's, is, from `at`, onto `out`.
38def places(
39  nodes: List<&2, Lint.Node>,
40  +at: U32,
41  out: Map<&2, Maybe<&2, Place>>
42) -> Map<&2, Maybe<&2, Place>>:
43  match nodes:
44    case Nil{}:
45      out
46    case Con{Lint.Node{Lint.Definition{t, u}, name, s, k, f}, rest}:
47      places(rest, (at + 1: U32), Map.set(&2, Maybe<&2, Place>, out, t, Some{Place{at, name}}))
48    case Con{node, rest}:
49      places(rest, (at + 1: U32), out)

Uses (9)

Used by (1)