def bound

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

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/strings.bend as Strings

275# A let that binds one name to a call of `target`, if `node` is one.
276def bound(+node: Lint.Node, +owner: Owner) -> Maybe<&2, Bound>:
277  match node owner:
278    case Lint.Node{
279      Lint.Destructure{q},
280      n,
281      s,
282      Con{
283        Lint.Node{Lint.PatternVariable{b, pq}, pn, Some{Lint.Span{p, +from, end}}, pk, pf},
284        Con{value, Con{rest, Nil{}}}
285      },
286      f
287    } Owner{target, name, io, text}:
288      Maybe.map(
289        &2,
290        Lint.Node,
291        Bound,
292        call => Bound{from, trimmed(Strings.slice(text, from, end)), b, call},
293        called(value, target)
294      )
295    case _ _:
296      None{}

Uses (11)

Used by (3)