def nodes

bolt@1.27.0.0 · src/rules/laws/law.bend:80

import bolt@1.27.0.0/src/rules/laws/law.bend as Law
import Base
import bolt@1.27.0.0/src/syntax/outline.bend as Outline
import bolt@1.27.0.0/src/rules/digest.bend as Digest
import bolt@1.27.0.0/src/rules/imports.bend as Imports

80# the items of a file as nodes onto the others: a def leads to what it
81# calls, a type and its constructors to nothing
82def nodes(ts: List<&2, Digest.Top>, +pp: String, more: List<&2, Imports.Edge>) -> List<&2, Imports.Edge>:
83  match ts:
84    case Nil{}:
85      more
86    case Con{Digest.Top{Outline.IDef{}, name, line, cs, calls}, rest}:
87      Imports.Edge{key(pp, name), keys(calls)} <> nodes(rest, pp, more)
88    case Con{Digest.Top{Outline.IType{}, name, line, cs, calls}, rest}:
89      Imports.Edge{key(pp, name), []} <> ctor_nodes(cs, pp, nodes(rest, pp, more))
90    case Con{other, rest}:
91      nodes(rest, pp, more)

Uses (8)

Used by (1)