def fixed
bend-lint-rules@0.2.0.0 · performance/loop_invariant_call.bend:96
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
import bend-lint-api@0.2.0.0/shared/lists.bend as Lists
96
97
98def fixed(
99 nodes: List<&2, Lint.Node>,
100 +calls: List<&2, List<&2, Lint.Node>>,
101 +at: Nat,
102 out: List<&2, U32>
103) -> List<&2, U32>:
104 match nodes:
105 case Nil{}:
106 out
107 case Con{Lint.Node{Lint.Parameter{+b, q}, n, s, k, f}, rest}:
108 fixed(
109 rest,
110 calls,
111 1n+at,
112 Lists.push(U32, Lists.when(U32, passed(calls, at, b, True{}), b), out)
113 )
114 case Con{node, rest}:
115 fixed(rest, calls, at, out)