use @hasDecl
This commit is contained in:
parent
b807ff8768
commit
14d82a13b7
1 changed files with 2 additions and 6 deletions
|
|
@ -459,13 +459,9 @@ pub const Record = struct {
|
||||||
inx = try self.setField(inx, f.name, f.type, f.default_value_ptr, field_val);
|
inx = try self.setField(inx, f.name, f.type, f.default_value_ptr, field_val);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
.@"union" => |info| {
|
.@"union" => {
|
||||||
const active_tag_name = @tagName(val);
|
const active_tag_name = @tagName(val);
|
||||||
comptime var has_decl = false;
|
const key = if (@hasDecl(U, "srf_tag_field"))
|
||||||
inline for (info.decls) |d| {
|
|
||||||
if (comptime std.mem.eql(u8, "srf_tag_field", d.name)) has_decl = true;
|
|
||||||
}
|
|
||||||
const key = if (has_decl)
|
|
||||||
U.srf_tag_field
|
U.srf_tag_field
|
||||||
else
|
else
|
||||||
"active_tag";
|
"active_tag";
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue