def slots
bend-lint-rules@0.2.0.0 · performance/gpu_fit.bend:47
import bend-lint-rules@0.2.0.0/performance/gpu_fit.bend as GpuFit
import Base
import bend-lint-api@0.2.0.0/linter/lint.bend as Lint
47
48def slots(nodes: List<&2, Lint.Node>, +current: String, out: List<&2, Slot>) -> List<&2, Slot>:
49 match nodes:
50 case Nil{}:
51 out
52 case Con{Lint.Node{Lint.Datatype{t}, n, s, kids, f}, rest}:
53 slots(rest, current, slots(kids, t, out))
54 case Con{Lint.Node{Lint.Constructor{t}, n, s, kids, f}, rest}:
55 slots(rest, current, slots(kids, current, out))
56 case Con{Lint.Node{Lint.Field{b, q}, n, s, kids, f}, rest}:
57 slots(rest, current, Slot{current, Lint.type_name(kids)} <> out)
58 case Con{node, rest}:
59 slots(rest, current, out)