def users
bend-lint-rules@0.2.0.0 · language/forward_reference.bend:90
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
import bend-lint-api@0.2.0.0/shared/lists.bend as Lists
90
91def users(
92 nodes: List<&2, Lint.Node>,
93 +places: Map<&2, Maybe<&2, Place>>,
94 +at: U32,
95 out: List<&2, Lint.Finding>
96) -> List<&2, Lint.Finding>:
97 match nodes:
98 case Nil{}:
99 List.reverse(&2, Lint.Finding, out)
100 case Con{Lint.Node{Lint.Definition{t, False{}}, +name, s, k, f}, rest}:
101 users(
102 rest,
103 places,
104 (at + 1: U32),
105 Lists.onto(
106 &2,
107 Lint.Finding,
108 Lint.visit(
109 ~User,
110 ~Lint.Finding,
111 ~use,
112 User{places, at, name},
113 [Lint.Node{Lint.Definition{t, False{}}, name, s, k, f}]
114 ),
115 out
116 )
117 )
118 case Con{node, rest}:
119 users(rest, places, (at + 1: U32), out)