DoxigAlpha

setExtra

Function parameters

Parameters

#
wip:*Wip
index:usize
extra:anytype

Type definitions in this namespace

Types

#
ErrorMessageList
There will be a MessageIndex for each len at start.
SourceLocation
Trailing:
ErrorMessage
Trailing:

Functions in this namespace

Functions

#
nullTerminatedString
Given an index into `string_bytes` returns the null-terminated string found there.

Special encoding when there are no errors.

Values

#
empty
Special encoding when there are no errors.

Source

Implementation

#
fn setExtra(wip: *Wip, index: usize, extra: anytype) void {
    const fields = @typeInfo(@TypeOf(extra)).@"struct".fields;
    var i = index;
    inline for (fields) |field| {
        wip.extra.items[i] = switch (field.type) {
            u32 => @field(extra, field.name),
            MessageIndex => @intFromEnum(@field(extra, field.name)),
            SourceLocationIndex => @intFromEnum(@field(extra, field.name)),
            else => @compileError("bad field type"),
        };
        i += 1;
    }
}