Return type of field of property instead of property.
This commit is contained in:
@@ -33,9 +33,9 @@ shape: ShapeKind,
|
||||
properties: std.ArrayList(Property),
|
||||
children: std.ArrayList(Object),
|
||||
|
||||
pub fn getProperty(self: Object, tag: std.meta.Tag(PropertyData)) ?*const PropertyData {
|
||||
pub fn getProperty(self: Object, comptime tag: std.meta.Tag(PropertyData)) ?@FieldType(PropertyData, @tagName(tag)) {
|
||||
for (self.properties.items) |*prop| {
|
||||
if (std.meta.activeTag(prop.data) == tag) return &prop.data;
|
||||
if (std.meta.activeTag(prop.data) == tag) return @field(prop.data, @tagName(tag));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user