chore: changes for lang.Type

This commit is contained in:
Nurul Huda (Apon) 2026-06-04 16:31:44 +06:00
parent 2cb7b2709d
commit eeac7a08b6
No known key found for this signature in database
GPG key ID: 5D3F1DE2855A2F79
2 changed files with 13 additions and 13 deletions

View file

@ -14,8 +14,8 @@
.lazy = true,
},
.build_crab = .{
.url = "git+https://github.com/nurulhudaapon/build.crab?ref=zig-dev#fd666880b60cd9b209459a6966689113978aaf03",
.hash = "build_crab-0.2.1-U0id_xnKAACLofQELmEzeT_mjjbHeCs9SfEoSg6nBBGC",
.url = "git+https://github.com/nurulhudaapon/build.crab?ref=zig-dev#69a630f8fa9ccca37a8ba2e898e7934e3b5b8fe2",
.hash = "build_crab-0.2.1-U0id_zfKAAAvOuam-kPYKMuEQpHuEBjrP96uQCVj94yr",
},
},
.paths = .{

View file

@ -526,10 +526,10 @@ fn assertDecls(comptime T: type, checks: anytype) !void {
var hasField = false;
if (typeInfo == .@"struct") {
const struct_info = typeInfo.@"struct";
inline for (struct_info.fields) |field| {
inline for (struct_info.field_names) |field_name| {
// Check both camelCase and snake_case
if (std.mem.eql(u8, field.name, check) or
std.mem.eql(u8, field.name, camelToSnakeCase(check)))
if (std.mem.eql(u8, field_name, check) or
std.mem.eql(u8, field_name, camelToSnakeCase(check)))
{
hasField = true;
break;
@ -548,39 +548,39 @@ fn assertDecls(comptime T: type, checks: anytype) !void {
const struct_info = typeInfo.@"struct";
// Check declarations
inline for (struct_info.decls) |decl| {
inline for (struct_info.decl_names) |decl_name| {
// Allow deinit as extraneous
if (comptime std.mem.eql(u8, decl.name, "deinit")) continue;
if (comptime std.mem.eql(u8, decl_name, "deinit")) continue;
var found = false;
inline for (checks) |check| {
if (std.mem.eql(u8, decl.name, check)) {
if (std.mem.eql(u8, decl_name, check)) {
found = true;
break;
}
}
if (!found) {
std.log.err("Extraneous {s} decl: {s}", .{ @typeName(T), decl.name });
std.log.err("Extraneous {s} decl: {s}", .{ @typeName(T), decl_name });
try std.testing.expect(false);
}
}
// Check fields (properties)
inline for (struct_info.fields) |field| {
inline for (struct_info.field_names) |field_name| {
// Allow internal fields (starting with underscore)
if (comptime std.mem.startsWith(u8, field.name, "_")) continue;
if (comptime std.mem.startsWith(u8, field_name, "_")) continue;
var found = false;
inline for (checks) |check| {
if (std.mem.eql(u8, field.name, camelToSnakeCase(check))) {
if (std.mem.eql(u8, field_name, camelToSnakeCase(check))) {
found = true;
break;
}
}
if (!found) {
std.log.err("Extraneous {s} field: {s}", .{ @typeName(T), field.name });
std.log.err("Extraneous {s} field: {s}", .{ @typeName(T), field_name });
try std.testing.expect(false);
}
}