Function rootDecls [src]
Prototype
pub fn rootDecls(tree: Ast) []const Node.Index
Parameters
tree: Ast
Source
pub fn rootDecls(tree: Ast) []const Node.Index {
switch (tree.mode) {
.zig => return tree.extraDataSlice(tree.nodeData(.root).extra_range, Node.Index),
// Ensure that the returned slice points into the existing memory of the Ast
.zon => return (&tree.nodes.items(.data)[@intFromEnum(Node.Index.root)].node)[0..1],
}
}