def judged

bend-lint-rules@0.2.0.0 · performance/repeated_call.bend:217

import bend-lint-rules@0.2.0.0/performance/repeated_call.bend as RepeatedCall
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

217# The findings about the calls of one definition (`loop`, as written) that repeat an earlier one, onto `out`.
218def judged(
219  calls: List<&2, Call>,
220  +seen: List<&2, Call>,
221  +loop: String,
222  out: List<&2, Lint.Finding>
223) -> List<&2, Lint.Finding>:
224  match calls:
225    case Nil{}:
226      out
227    case Con{+c, rest}:
228      judged(
229        rest,
230        c <> seen,
231        loop,
232        Lists.onto(
233          &2,
234          Lint.Finding,
235          Lint.finding(
236            Lint.Information{},
237            repeats(seen, c, False{}),
238            Some{Call.span(c)},
239            message(Call.callee(c), loop)
240          ),
241          out
242        )
243      )

Uses (13)

Used by (1)