Update uses of @fieldParentPtr to pass a pointer type
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user