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/ › translate-c/ › Translator.zig › transTypeInfo
transTypeInfo
Translator.transTypeInfo
fn transTypeInfo (
t : *Translator ,
scope : *Scope ,
op : ZigTag ,
typeinfo : Node .TypeInfo ,
) TransError !ZigNode
File
Code
fn transTypeInfo (
t : *Translator ,
scope : *Scope ,
op : ZigTag ,
typeinfo : Node .TypeInfo ,
) TransError !ZigNode {
const operand = operand : {
if (typeinfo .expr ) |expr | {
const operand = try t .transExpr (scope , expr , .used );
if (operand .tag () == .string_literal ) {
const deref = try ZigTag .deref .create (t .arena , operand );
break :operand try ZigTag .typeof .create (t .arena , deref );
}
break :operand try ZigTag .typeof .create (t .arena , operand );
}
break :operand try t .transType (scope , typeinfo .operand_qt , typeinfo .op_tok );
};
const payload = try t .arena .create (ast .Payload .UnOp );
payload .* = .{
.base = .{ .tag = op },
.data = operand ,
};
return ZigNode .initPayload (&payload .base );
}