fix: release mode undefined usage (for optionals); bump to 0.14.dev
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 54s
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 54s
This commit is contained in:
@@ -18,15 +18,15 @@ pub fn Layout(comptime Event: type, comptime Element: type, comptime Renderer: t
|
||||
if (!isTaggedUnion(Element)) {
|
||||
@compileError("Provided type `Element` for `Layout(comptime Event: type, comptime Element: type, comptime Renderer: type)` is not of type `union(enum)`.");
|
||||
}
|
||||
if (!std.mem.eql(u8, @typeInfo(Element).Union.fields[0].name, "layout")) {
|
||||
@compileError("Expected `layout: Layout` to be the first union element, but has name: " ++ @typeInfo(Element).Union.fields[0].name);
|
||||
if (!std.mem.eql(u8, @typeInfo(Element).@"union".fields[0].name, "layout")) {
|
||||
@compileError("Expected `layout: Layout` to be the first union element, but has name: " ++ @typeInfo(Element).@"union".fields[0].name);
|
||||
}
|
||||
if (!std.mem.eql(u8, @typeInfo(Element).Union.fields[1].name, "widget")) {
|
||||
@compileError("Expected `widget: Widget` to be the first union element, but has name: " ++ @typeInfo(Element).Union.fields[1].name);
|
||||
if (!std.mem.eql(u8, @typeInfo(Element).@"union".fields[1].name, "widget")) {
|
||||
@compileError("Expected `widget: Widget` to be the first union element, but has name: " ++ @typeInfo(Element).@"union".fields[1].name);
|
||||
}
|
||||
const Elements = std.ArrayList(Element);
|
||||
const LayoutType = @typeInfo(Element).Union.fields[0].type;
|
||||
const WidgetType = @typeInfo(Element).Union.fields[1].type;
|
||||
const LayoutType = @typeInfo(Element).@"union".fields[0].type;
|
||||
const WidgetType = @typeInfo(Element).@"union".fields[1].type;
|
||||
const Events = std.ArrayList(Event);
|
||||
return struct {
|
||||
// TODO: current focused `Element`?
|
||||
@@ -37,11 +37,11 @@ pub fn Layout(comptime Event: type, comptime Element: type, comptime Renderer: t
|
||||
pub fn init(allocator: std.mem.Allocator, children: anytype) @This() {
|
||||
const ArgsType = @TypeOf(children);
|
||||
const args_type_info = @typeInfo(ArgsType);
|
||||
if (args_type_info != .Struct) {
|
||||
if (args_type_info != .@"struct") {
|
||||
@compileError("expected tuple or struct argument, found " ++ @typeName(ArgsType));
|
||||
}
|
||||
const fields_info = args_type_info.Struct.fields;
|
||||
var elements = Elements.initCapacity(allocator, fields_info.len) catch @panic("OOM");
|
||||
const fields_info = args_type_info.@"struct".fields;
|
||||
var elements = Elements.initCapacity(allocator, fields_info.len) catch @panic("VStack.zig out of memory");
|
||||
inline for (comptime fields_info) |field| {
|
||||
const child = @field(children, field.name);
|
||||
const ChildType = @TypeOf(child);
|
||||
|
||||
Reference in New Issue
Block a user