feature. See also
. The project being documented here (as the example) is the Zig library itself.
Walk.block
fn block(
w: *Walk,
parent_scope: *Scope,
parent_decl: Decl.Index,
statements: []const Ast.Node.Index,
) Oom!void
File
Code
fn block(
w: *Walk,
parent_scope: *Scope,
parent_decl: Decl.Index,
statements: []const Ast.Node.Index,
) Oom!void {
const ast = w.file.get_ast();
var scope = parent_scope;
for (statements) |node| {
switch (ast.nodeTag(node)) {
.global_var_decl,
.local_var_decl,
.simple_var_decl,
.aligned_var_decl,
=> {
const full = ast.fullVarDecl(node).?;
try global_var_decl(w, scope, parent_decl, full);
const local = try gpa.create(Scope.Local);
local.* = .{
.parent = scope,
.var_node = node,
};
try w.file.get().scopes.putNoClobber(gpa, node, &local.base);
scope = &local.base;
},
.assign_destructure => {
log.debug("walk assign_destructure not implemented yet", .{});
},
.grouped_expression => try expr(w, scope, parent_decl, ast.nodeData(node).node_and_token[0]),
.@"defer", .@"errdefer" => try expr(w, scope, parent_decl, ast.nodeData(node).node),
else => try expr(w, scope, parent_decl, node),
}
}
}