def work.hot

bolt@1.27.0.0 · src/rules/suspicious/eager.bend:69

import bolt@1.27.0.0/src/rules/suspicious/eager.bend as Eager
import Base
import bolt@1.27.0.0/src/syntax/lex.bend as Lex

69# the hot a leaf leaves behind: a `=>` clears it for the lambda's body; a
70# comma of a pick's own group moves to its next argument, hot from the third
71# on (0 the type, 1 the condition, 2 and 3 the branches), and a comma of any
72# other group returns it to keep; any other leaf leaves it as it was
73def work.hot(kk: Lex.TokKind, +hot: Bool, +seg: U32, +keep: Bool) -> Bool:
74  match kk:
75    case Lex.TLam{}:
76      False{}
77    case Lex.TComma{}:
78      +in_pick = U32.is_lt(seg, 9)
79      +next = Bool.pick(U32, in_pick, (seg + 1 : U32), seg)
80      Bool.pick(Bool, in_pick, Bool.not(U32.is_lt(next, 2)), keep)
81    case other:
82      hot

Uses (7)

Used by (1)