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 › addFieldAccess Private Function addFieldAccess Doc Source Private Function std.zig.AstGen.addFieldAccess
fn addFieldAccess (
tag : Zir .Inst .Tag ,
gz : *GenZir ,
scope : *Scope ,
lhs_ri : ResultInfo ,
node : Ast .Node .Index ,
) InnerError !Zir .Inst .Ref Params Errors File zig/AstGen.zig: 5985
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006 fn addFieldAccess (
tag : Zir .Inst .Tag ,
gz : *GenZir ,
scope : *Scope ,
lhs_ri : ResultInfo ,
node : Ast .Node .Index ,
) InnerError !Zir .Inst .Ref {
const astgen = gz .astgen ;
const tree = astgen .tree ;
const object_node , const field_ident = tree .nodeData (node ).node_and_token ;
const str_index = try astgen .identAsString (field_ident );
const lhs = try expr (gz , scope , lhs_ri , object_node );
const cursor = maybeAdvanceSourceCursorToMainToken (gz , node );
try emitDbgStmt (gz , cursor );
return gz .addPlNode (tag , node , Zir .Inst .Field {
.lhs = lhs ,
.field_name_start = str_index ,
});
}