freetype: find and fix bugs by fixing refAllDecls()

This commit is contained in:
Ali Chraghi 2022-06-10 17:01:27 +04:30 committed by Stephen Gutekanst
parent 2b7527b028
commit 9c585693b1
8 changed files with 35 additions and 32 deletions

View file

@ -21,15 +21,16 @@ pub fn bitFieldsToStruct(comptime StructType: type, comptime EnumDataType: type,
}
pub fn refAllDecls(comptime T: type) void {
switch (@typeInfo(T)) {
.Struct, .Union, .Opaque, .Enum => {
inline for (comptime std.meta.declarations(T)) |decl| {
if (decl.is_pub) {
refAllDecls(@TypeOf(@field(T, decl.name)));
std.testing.refAllDecls(T);
@setEvalBranchQuota(10000);
inline for (comptime std.meta.declarations(T)) |decl| {
if (decl.is_pub) {
if (@TypeOf(@field(T, decl.name)) == type) {
switch (@typeInfo(@field(T, decl.name))) {
.Struct, .Enum, .Union, .Opaque => refAllDecls(@field(T, decl.name)),
else => {},
}
}
},
else => {},
_ = @field(T, decl.name);
}
}
}