def foreign

bolt@1.27.0.0 · src/rules/suspicious/unused.bend:74

import bolt@1.27.0.0/src/rules/suspicious/unused.bend as Unused
import Base
import bolt@1.27.0.0/src/syntax/tree.bend as Tree

74# every header line of the defs whose body is `import "./x.c"`, wherever the
75# header's `->` and return type fall
76def foreign(root: Tree.Node) -> List<&2, U32>:
77  match root:
78    case Tree.NCons{Tree.Stmt{Tree.SDef{}, +kids, body}, rest}:
79      +more = foreign(rest)
80      +own = lines(Tree.leaves(kids), more)
81      Bool.pick(List<&2, U32>, foreign.opens(body, Bool.not(foreign.ends(kids, False{}))), own, more)
82    case Tree.NCons{other, rest}:
83      foreign(rest)
84    case other:
85      Nil{}

Uses (11)

Used by (1)