def items

bolt@1.27.0.0 · src/syntax/bind.bend:148

import bolt@1.27.0.0/src/syntax/bind.bend as Bind
import Base
import bolt@1.27.0.0/src/syntax/tree.bend as Tree

148# the defs, laws, types and constructors of a source
149def items(root: Tree.Node, acc: List<&2, String>) -> List<&2, String>:
150  match root:
151    case Tree.NCons{Tree.Stmt{Tree.SDef{}, kids, body}, rest}:
152      items(rest, push_name(declared(kids), acc))
153    case Tree.NCons{Tree.Stmt{Tree.SLaw{}, kids, body}, rest}:
154      items(rest, push_name(declared(kids), acc))
155    case Tree.NCons{Tree.Stmt{Tree.SType{}, kids, body}, rest}:
156      items(rest, ctors(body, push_name(declared(kids), acc)))
157    case Tree.NCons{other, rest}:
158      items(rest, acc)
159    case other:
160      acc

Uses (7)

Used by (1)