fn addTypeExtraAssumeCapacity(self: *Builder, extra: anytype) Type.Item.ExtraIndex self: *Builderextra12204
12205
12206
12207
12208
12209
12210
12211
12212
12213
12214
12215
12216fn addTypeExtraAssumeCapacity(self: *Builder, extra: anytype) Type.Item.ExtraIndex {
const result: Type.Item.ExtraIndex = @intCast(self.type_extra.items.len);
const info = @typeInfo(@TypeOf(extra)).@"struct";
inline for (info.field_names, info.field_types) |field_name, field_type| {
const value = @field(extra, field_name);
self.type_extra.appendAssumeCapacity(switch (field_type) {
u32 => value,
String, Type => @backingInt(value),
else => @compileError("bad field type: " ++ field_name ++ ": " ++ @typeName(field_type)),
});
}
return result;
}