enum as subtype
Some checks failed
e2e-test / zig build release (push) Has been cancelled
e2e-test / puppeteer-perf (push) Has been cancelled
e2e-test / demo-scripts (push) Has been cancelled
wpt / web platform tests (push) Has been cancelled
wpt / web platform tests json output (push) Has been cancelled
wpt / perf-fmt (push) Has been cancelled
zig-test / zig build dev (push) Has been cancelled
zig-test / browser fetch (push) Has been cancelled
zig-test / zig test (push) Has been cancelled
zig-test / perf-fmt (push) Has been cancelled

This commit is contained in:
sjorsdonkers
2025-04-18 12:03:43 +02:00
committed by Sjors
parent 1cd3ebfc3f
commit 16a30fa3b7
14 changed files with 81 additions and 83 deletions

View File

@@ -96,9 +96,7 @@ pub fn Env(comptime S: type, comptime types: anytype) type {
@compileError(std.fmt.comptimePrint("Prototype '{s}' for type '{s} must be a pointer", .{ @typeName(Struct.prototype), @typeName(Struct) }));
}
@setEvalBranchQuota(40_000); // The number of branches increases as we get more structs with the subtype field
const subtype: ?SubType =
if (@hasDecl(Struct, "subtype")) std.meta.stringToEnum(SubType, Struct.subtype) else null;
const subtype: ?SubType = if (@hasDecl(Struct, "subtype")) Struct.subtype else null;
const R = Receiver(@field(types, s.name));
fields[i] = .{