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 › transGlobalAsm
transGlobalAsm
Translator.transGlobalAsm
fn transGlobalAsm (t : *Translator , scope : *Scope , global_asm : Node .GlobalAsm ) Error !void
File
Code
fn transGlobalAsm (t : *Translator , scope : *Scope , global_asm : Node .GlobalAsm ) Error !void {
const asm_string = t .tree .value_map .get (global_asm .asm_str ).?;
const bytes = t .comp .interner .get (asm_string .ref ()).bytes ;
var allocating : std .Io .Writer .Allocating = try .initCapacity (t .gpa , bytes .len );
defer allocating .deinit ();
aro .Value .printString (bytes , global_asm .asm_str .qt (t .tree ), t .comp , &allocating .writer ) catch return error .OutOfMemory ;
const str_node = try ZigTag .string_literal .create (t .arena , try t .arena .dupe (u8 , allocating .written ()));
const asm_node = try ZigTag .asm_simple .create (t .arena , str_node );
const block = try ZigTag .block_single .create (t .arena , asm_node );
const comptime_node = try ZigTag .@"comptime" .create (t .arena , block );
try scope .appendNode (comptime_node );
}