def unflat

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

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

227# The definitions among a file's `nodes` whose own body keeps them from compiling to a native loop, onto `out`: a
228# parallel let is in them, or a closure's application.
229def unflat(nodes: List<&2, Lint.Node>, out: List<&2, String>) -> List<&2, String>:
230  match nodes:
231    case Nil{}:
232      out
233    case Con{Lint.Node{Lint.Definition{t, u}, n, s, +kids, f}, rest}:
234      unflat(
235        rest,
236        Lists.push(String, Lists.when(String, applies(kids, Lint.forks(kids, False{})), t), out)
237      )
238    case Con{node, rest}:
239      unflat(rest, out)

Uses (9)

Used by (1)