{frreetype,sysaudio}: use std.refAllDeclsRecursive

added to stdlib via #12103
This commit is contained in:
alichraghi 2022-07-17 12:36:22 +04:30 committed by Stephen Gutekanst
parent 0ff83ba517
commit be9d2b431f
4 changed files with 23 additions and 51 deletions

View file

@ -8,15 +8,15 @@ pub const Glyph = @import("Glyph.zig");
pub const Stroker = @import("Stroker.zig");
pub const Error = @import("error.zig").Error;
const utils = @import("utils");
const std = @import("std");
test {
utils.refAllDecls(@import("freetype.zig"));
utils.refAllDecls(@import("types.zig"));
utils.refAllDecls(@import("image.zig"));
utils.refAllDecls(@import("color.zig"));
utils.refAllDecls(@import("lcdfilter.zig"));
utils.refAllDecls(@import("error.zig"));
utils.refAllDecls(Glyph);
utils.refAllDecls(Stroker);
std.testing.refAllDeclsRecursive(@import("freetype.zig"));
std.testing.refAllDeclsRecursive(@import("types.zig"));
std.testing.refAllDeclsRecursive(@import("image.zig"));
std.testing.refAllDeclsRecursive(@import("color.zig"));
std.testing.refAllDeclsRecursive(@import("lcdfilter.zig"));
std.testing.refAllDeclsRecursive(@import("error.zig"));
std.testing.refAllDeclsRecursive(Glyph);
std.testing.refAllDeclsRecursive(Stroker);
}

View file

@ -7,14 +7,14 @@ pub usingnamespace @import("shape.zig");
pub usingnamespace @import("shape_plan.zig");
pub const c = @import("c");
const utils = @import("utils");
const std = @import("std");
test {
utils.refAllDecls(@import("blob.zig"));
utils.refAllDecls(@import("buffer.zig"));
utils.refAllDecls(@import("common.zig"));
utils.refAllDecls(@import("face.zig"));
utils.refAllDecls(@import("font.zig"));
utils.refAllDecls(@import("shape.zig"));
utils.refAllDecls(@import("shape_plan.zig"));
std.testing.refAllDeclsRecursive(@import("blob.zig"));
std.testing.refAllDeclsRecursive(@import("buffer.zig"));
std.testing.refAllDeclsRecursive(@import("common.zig"));
std.testing.refAllDeclsRecursive(@import("face.zig"));
std.testing.refAllDeclsRecursive(@import("font.zig"));
std.testing.refAllDeclsRecursive(@import("shape.zig"));
std.testing.refAllDeclsRecursive(@import("shape_plan.zig"));
}

View file

@ -19,18 +19,3 @@ pub fn bitFieldsToStruct(comptime StructType: type, comptime EnumDataType: type,
}
return value;
}
pub fn refAllDecls(comptime T: type) void {
@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 => {},
}
}
_ = @field(T, decl.name);
}
}
}