def converted

bolt@1.27.0.0 · src/rules/pedantic/fuel.bend:103

import bolt@1.27.0.0/src/rules/pedantic/fuel.bend as Fuel
import Base
import bolt@1.27.0.0/src/finding.bend as F
import bolt@1.27.0.0/src/syntax/lex.bend as Lex
import bolt@1.27.0.0/src/syntax/tree.bend as Tree
import bolt@1.27.0.0/src/rules/tokens.bend as T

103# the group of a call at line ll, column cc, as a finding when it holds one
104# U32 literal alone (digits) and ok says the call is `U32.to_nat(`
105def converted(kids: Tree.Node, ok: Bool, +ll: U32, +cc: U32, +path: String) -> List<&2, F.Finding>:
106  match kids:
107    case Tree.NCons{Tree.Leaf{Lex.Tok{Lex.TNum{}, +t, l, c}}, Tree.NNil{}}:
108      Bool.pick(List<&2, F.Finding>, Bool.and(ok, T.digits_ok(String.to_list(t))),
109        [F.Finding{path, ll, cc, U32.from_nat(Nat.add(String.length(t), 12n)), "fuel",
110          "The fuel is fixed at U32.to_nat(" ++ t
111            ++ "), so longer input is silently cut short; derive the fuel from the input size."}],
112        [])
113    case other:
114      Nil{}

Uses (16)

Used by (1)