def innermost

bend-lint-rules@0.2.0.0 · performance/list_index_loop.bend:157

import bend-lint-rules@0.2.0.0/performance/list_index_loop.bend as ListIndexLoop
import Base
import bend-lint-api@0.2.0.0/linter/lint.bend as Lint

157# The innermost case above `path`, if any: a call of the loop must be in it to pass the list on in the same branch.
158def innermost(path: List<&2, Lint.Above>, owner: Lint.Node) -> Lint.Node:
159  match path:
160    case Nil{}:
161      owner
162    case Con{Lint.Above{Lint.Node{Lint.Case{}, n, s, k, f}, at}, rest}:
163      Lint.Node{Lint.Case{}, n, s, k, f}
164    case Con{a, rest}:
165      innermost(rest, owner)

Uses (4)

Used by (1)