Graph.initialize

Initializes an empty Gyre graph, must be later disposed to avoid leaking memory.

Our graphs eliminate dead code automatically. Therefore, every static top-level definition must be "anchored" to the graph, as if it was being "exported" to code outside of this graph. Nodes which are not directly exported and aren't reachable by an exported node may be marked as dead code and silently eliminated. Similarly, a graph may also depend on external information (type parameters, for instance), in which case it needs to point to these imported definitions.

struct Graph
@nogc nothrow
initialize
(
MacroNode.ID id
,
uint exports = 1
,
uint imports = 0
,
size_t capacity = 64
)

Parameters

id MacroNode.ID

This graph's unique identifier.

exports uint

Preallocated number of "exported" defs (or in-edges for macro node definitions).

imports uint

Maximum number of "imported" defs (or out-edges for macro node definitions).

capacity size_t

Number of nodes to preallocate.

Return Value

Type: err_t

Zero on success, non-zero on failure (in which case the graph can't be safely used).