def Run.add

bend-lint-rules@0.2.0.0 · performance/missed_fork.bend:380

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

380# The run after a let (`bound`, if it is one): the let joins it if its call uses no binder of the run; else the run
381# ends, and the let starts the next.
382def Run.add(bound: Maybe<&2, Bound>, owner: Owner, run: Run) -> Run:
383  match bound run:
384    case Some{Bound{+f, +w, +b, +c}} Run{+bounds, +binders, +out}:
385      Bool.pick(
386        Run,
387        uses([c], binders, False{}),
388        Run{
389          [Bound{f, w, b, c}],
390          [b],
391          Lists.onto(&2, Lint.Finding, Run.finding(bounds, owner), out)
392        },
393        Run{Bound{f, w, b, c} <> bounds, b <> binders, out}
394      )
395    case None{} Run{bounds, binders, out}:
396      Run{[], [], Lists.onto(&2, Lint.Finding, Run.finding(bounds, owner), out)}

Uses (11)

Used by (1)