Zig 0.17.0-dev (Split by item)
This is an example of documentation generated by
ZigDoc , an alternative to Zig's built-in
Auto Doc feature. See also
examples in other modes/formats . The project being documented here (as the example) is the Zig library itself.
Zig › compiler/ › reduce/ › Walk.zig › walkBuiltinCall
walkBuiltinCall
Walk.walkBuiltinCall
fn walkBuiltinCall (
w : *Walk ,
call_node : Ast .Node .Index ,
params : []const Ast .Node .Index ,
) Error !void
File
Code
fn walkBuiltinCall (
w : *Walk ,
call_node : Ast .Node .Index ,
params : []const Ast .Node .Index ,
) Error !void {
const ast = w .ast ;
const builtin_token = ast .nodeMainToken (call_node );
const builtin_name = ast .tokenSlice (builtin_token );
const info = BuiltinFn .list .get (builtin_name ).?;
switch (info .tag ) {
.import => {
const operand_node = params [0 ];
const str_lit_token = ast .nodeMainToken (operand_node );
const token_bytes = ast .tokenSlice (str_lit_token );
if (std .mem .endsWith (u8 , token_bytes , ".zig\"" )) {
const imported_string = std .zig .string_literal .parseAlloc (w .arena , token_bytes ) catch
unreachable ;
try w .transformations .append (.{ .inline_imported_file = .{
.builtin_call_node = call_node ,
.imported_string = imported_string ,
.in_scope_names = try std .array_hash_map .String (void ).init (
w .arena ,
w .in_scope_names .keys (),
&.{},
),
} });
}
},
else => {},
}
for (params ) |param_node | {
try walkExpression (w , param_node );
}
}