def definitions

bend-lint-api@0.2.0.0 · linter/lint.bend:427

import bend-lint-api@0.2.0.0/linter/lint.bend as Lint
import Base
import bend-lint-api@0.2.0.0/shared/names.bend as Names

427# The definitions of `nodes`, by the name the check gives them: read one with `Names.find`. Of two with one name, the
428# later is kept.
429def definitions(nodes: List<&2, Node>, out: Map<&2, Maybe<&2, Node>>) -> Map<&2, Maybe<&2, Node>>:
430  match nodes:
431    case Nil{}:
432      out
433    case Con{Node{Definition{+t, u}, n, s, k, f}, rest}:
434      definitions(
435        rest,
436        Map.set(&2, Maybe<&2, Node>, out, t, Some{Node{Definition{t, u}, n, s, k, f}})
437      )
438    case Con{node, rest}:
439      definitions(rest, out)

Uses (6)

Used by (0)

No other definition uses this definition.