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 › simpleUnOp Private Function simpleUnOp Doc Source 9762
9763
9764
9765
9766
9767
9768
9769
9770
9771
9772
9773
9774
9775
9776
9777
9778
9779
9780
9781
9782 fn simpleUnOp (
gz : *GenZir ,
scope : *Scope ,
ri : ResultInfo ,
node : Ast .Node .Index ,
operand_ri : ResultInfo ,
operand_node : Ast .Node .Index ,
tag : Zir .Inst .Tag ,
) InnerError !Zir .Inst .Ref {
const cursor = maybeAdvanceSourceCursorToMainToken (gz , node );
const operand = if (tag == .compile_error )
try comptimeExpr (gz , scope , operand_ri , operand_node , .compile_error_string )
else
try expr (gz , scope , operand_ri , operand_node );
switch (tag ) {
.tag_name , .error_name , .int_from_ptr => try emitDbgStmt (gz , cursor ),
else => {},
}
const result = try gz .addUnNode (tag , operand , node );
return rvalue (gz , ri , result , node );
}