Update uses of @fieldParentPtr to pass a pointer type

This commit is contained in:
Jacob Young
2024-03-19 12:27:20 +01:00
parent 9b2345e182
commit e409afb79b
30 changed files with 87 additions and 87 deletions

View File

@@ -11686,20 +11686,20 @@ const Scope = struct {
fn cast(base: *Scope, comptime T: type) ?*T {
if (T == Defer) {
switch (base.tag) {
.defer_normal, .defer_error => return @fieldParentPtr(T, "base", base),
.defer_normal, .defer_error => return @alignCast(@fieldParentPtr(*align(1) T, "base", base)),
else => return null,
}
}
if (T == Namespace) {
switch (base.tag) {
.namespace => return @fieldParentPtr(T, "base", base),
.namespace => return @alignCast(@fieldParentPtr(*align(1) T, "base", base)),
else => return null,
}
}
if (base.tag != T.base_tag)
return null;
return @fieldParentPtr(T, "base", base);
return @alignCast(@fieldParentPtr(*align(1) T, "base", base));
}
fn parent(base: *Scope) ?*Scope {

View File

@@ -414,7 +414,7 @@ pub const Macros = struct {
}
pub fn WL_CONTAINER_OF(ptr: anytype, sample: anytype, comptime member: []const u8) @TypeOf(sample) {
return @fieldParentPtr(@TypeOf(sample.*), member, ptr);
return @fieldParentPtr(@TypeOf(sample), member, ptr);
}
/// A 2-argument function-like macro defined as #define FOO(A, B) (A)(B)