mirror of
https://github.com/ziglang/zig.git
synced 2026-02-15 22:09:49 +00:00
fix std.zig.Ast.rootDecls on .zon mode Ast
This commit is contained in:
parent
13a28345bb
commit
cc82620b2a
@ -205,9 +205,11 @@ pub fn extraData(tree: Ast, index: usize, comptime T: type) T {
|
||||
}
|
||||
|
||||
pub fn rootDecls(tree: Ast) []const Node.Index {
|
||||
// Root is always index 0.
|
||||
const nodes_data = tree.nodes.items(.data);
|
||||
return tree.extra_data[nodes_data[0].lhs..nodes_data[0].rhs];
|
||||
return switch (tree.mode) {
|
||||
.zig => tree.extra_data[nodes_data[0].lhs..nodes_data[0].rhs],
|
||||
.zon => (&nodes_data[0].lhs)[0..1],
|
||||
};
|
||||
}
|
||||
|
||||
pub fn renderError(tree: Ast, parse_error: Error, stream: anytype) !void {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user