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 › std/ › zig/ › AstGen.zig › assign
assign
AstGen.assign
fn assign (gz : *GenZir , scope : *Scope , infix_node : Ast .Node .Index ) InnerError !void
File
Code
fn assign (gz : *GenZir , scope : *Scope , infix_node : Ast .Node .Index ) InnerError !void {
try emitDbgNode (gz , infix_node );
const astgen = gz .astgen ;
const tree = astgen .tree ;
const lhs , const rhs = tree .nodeData (infix_node ).node_and_node ;
if (tree .nodeTag (lhs ) == .identifier ) {
const ident_name = tree .tokenSlice (tree .nodeMainToken (lhs ));
if (mem .eql (u8 , ident_name , "_" )) {
_ = try expr (gz , scope , .{ .rl = .discard , .ctx = .assignment }, rhs );
return ;
}
}
const lvalue = try lvalExpr (gz , scope , lhs );
_ = try expr (gz , scope , .{ .rl = .{ .ptr = .{
.inst = lvalue ,
.src_node = infix_node ,
} } }, rhs );
}