def applies.visit

bend-lint-rules@0.2.0.0 · performance/eager_branch.bend:191

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

191# A closure's application: of a variable that no `~` parameter (`templates`) binds.
192def applies.visit(
193  +templates: List<&2, U32>,
194  +path: List<&2, Lint.Above>,
195  +node: Lint.Node
196) -> List<&2, Unit>:
197  match node:
198    case Lint.Node{
199      Lint.Application{},
200      n,
201      s,
202      Con{Lint.Node{Lint.Variable{b}, vn, vs, vk, vf}, args},
203      f
204    }:
205      Lists.push(
206        Unit,
207        Lists.when(Unit, Bool.not(List.contains(~U32, ~U32.is_eq, templates, b)), Unit{}),
208        []
209      )
210    case _:
211      []

Uses (11)

Used by (1)