def block

bend-lint-rules@0.2.0.0 · layout/imports.bend:124

import bend-lint-rules@0.2.0.0/layout/imports.bend as Imports
import Base
import bend-lint-api@0.2.0.0/linter/lint.bend as Lint

124# The block of the imports among `nodes`. A file's imports come first, so the first node of another kind ends them.
125def block(nodes: List<&2, Lint.Node>, +text: String, b: Block) -> Block:
126  match nodes:
127    case Con{
128      Lint.Node{
129        Lint.Import{loads},
130        alias,
131        Some{at},
132        Con{Lint.Node{Lint.ImportPath{}, path, s, k, f}, ks},
133        fs
134      },
135      rest
136    }:
137      block(rest, text, add(text, at, False{}, path, alias, loads, b))
138    case Con{Lint.Node{Lint.Import{loads}, alias, Some{at}, k, f}, rest}:
139      block(rest, text, add(text, at, True{}, "Base", alias, loads, b))
140    case _:
141      b

Uses (8)

Used by (1)