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 standard library.
std › zig › AstGen › hasDeclOrField Private Function hasDeclOrField Doc Source Private Function std.zig.AstGen.hasDeclOrField
fn hasDeclOrField (
gz : *GenZir ,
scope : *Scope ,
ri : ResultInfo ,
node : Ast .Node .Index ,
lhs_node : Ast .Node .Index ,
rhs_node : Ast .Node .Index ,
tag : Zir .Inst .Tag ,
) InnerError !Zir .Inst .Ref Params Errors File zig/AstGen.zig: 9704
9704
9705
9706
9707
9708
9709
9710
9711
9712
9713
9714
9715
9716
9717
9718
9719
9720
9721
9722
9723
9724
9725
9726 fn hasDeclOrField (
gz : *GenZir ,
scope : *Scope ,
ri : ResultInfo ,
node : Ast .Node .Index ,
lhs_node : Ast .Node .Index ,
rhs_node : Ast .Node .Index ,
tag : Zir .Inst .Tag ,
) InnerError !Zir .Inst .Ref {
const container_type = try typeExpr (gz , scope , lhs_node );
const name = try comptimeExpr (
gz ,
scope ,
.{ .rl = .{ .coerced_ty = .slice_const_u8_type } },
rhs_node ,
if (tag == .has_decl ) .decl_name else .field_name ,
);
const result = try gz .addPlNode (tag , node , Zir .Inst .Bin {
.lhs = container_type ,
.rhs = name ,
});
return rvalue (gz , ri , result , node );
}