def visit

bend-lint-rules@0.2.0.0 · performance/loop_invariant_call.bend:210

import bend-lint-rules@0.2.0.0/performance/loop_invariant_call.bend as LoopInvariantCall
import Base
import bend-lint-api@0.2.0.0/linter/lint.bend as Lint

210def visit(+owner: Owner, +path: List<&2, Lint.Above>, +node: Lint.Node) -> List<&2, Lint.Finding>:
211  match owner node:
212    case Owner{
213      loops,
214      +target,
215      name,
216      fixed
217    } Lint.Node{
218      Lint.Application{},
219      n,
220      span,
221      Con{Lint.Node{Lint.Reference{+t}, callee, rs, rk, rf}, args},
222      facts
223    }:
224      Lint.finding(
225        Lint.Information{},
226        repeats.if(
227          invariant(
228            64n,
229            args,
230            fixed,
231            Bool.not(String.eq(t, target)) && List.contains(~String, ~String.eq, loops, t)
232          )
233            && Lint.is_live(path),
234          path,
235          target
236        ),
237        span,
238        message(callee, name)
239      )
240    case _ _:
241      []

Uses (17)

Used by (2)