def rows.line

bend-lint-rules@0.2.0.0 · layout/format.bend:2241

import bend-lint-rules@0.2.0.0/layout/format.bend as Format
import Base

2241def rows.line(+head: Token, +record: List<&2, Tree>, +set: Settings, r: Rows) -> Rows:
2242  match set r:
2243    case Settings{+tab, width, newline} Rows{levels, +blank, unsafe, prior, rows}:
2244      +col = Token.col(head)
2245      +levels2 = indented(levels, col)
2246      +declaration = is_declaration(Token.sym(head))
2247      +comment = is_comment(head)
2248      gap = Bool.pick(
2249        Bool,
2250        U32.is_zero(col),
2251        (declaration && Bool.not(prior) && Bool.not(unsafe)) || (comment && blank),
2252        blank
2253      )
2254      doc = record_doc(is_import(Token.sym(head)), head, record, declaration, tab, col)
2255      fuel = U32.to_nat(
2256        (fuel_per_point() * ((record_end(head, record) - Token.beg(head): U32) + 1): U32)
2257      )
2258      Rows{
2259        levels2,
2260        False{},
2261        is_unsafe(is_sym(Token.sym(head), At{}), record),
2262        comment,
2263        Con{print(doc, width, (depth(levels2) * tab: U32), newline, fuel), gapped(gap, rows)}
2264      }

Uses (32)

Used by (1)