def defs
bend-lint-rules@0.2.0.0 · performance/unused_result.bend:114
import bend-lint-rules@0.2.0.0/performance/unused_result.bend as UnusedResult
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
114
115def defs(nodes: List<&2, Lint.Node>, out: List<&2, Unused>) -> List<&2, Unused>:
116 match nodes:
117 case Nil{}:
118 out
119 case Con{Lint.Node{Lint.Definition{t, u}, +n, s, k, f}, rest}:
120 +owner = {Lint.Node{Lint.Definition{t, u}, n, s, k, f}: Lint.Node}
121 defs(
122 rest,
123 Lists.onto(
124 &2,
125 Unused,
126 List.reverse(
127 &2,
128 Unused,
129 Lint.visit(
130 ~Owner,
131 ~Unused,
132 ~visit,
133 Owner{
134 Bool.not(
135 List.is_empty(&2, Unit, Lint.visit(~Unit, ~Unit, ~loop.visit, Unit{}, [owner]))
136 ),
137 n
138 },
139 [owner]
140 )
141 ),
142 out
143 )
144 )
145 case Con{node, rest}:
146 defs(rest, out)