mirror of
https://github.com/ziglang/zig.git
synced 2026-02-14 05:20:34 +00:00
Type: implement elemType2 for anyframe
This commit is contained in:
parent
9aae4d57cb
commit
1258b5f7d6
22
src/type.zig
22
src/type.zig
@ -784,7 +784,7 @@ pub const Type = extern union {
|
||||
|
||||
.anyframe_T => {
|
||||
if (b.zigTypeTag() != .AnyFrame) return false;
|
||||
return a.childType().eql(b.childType(), mod);
|
||||
return a.elemType2().eql(b.elemType2(), mod);
|
||||
},
|
||||
|
||||
.empty_struct => {
|
||||
@ -4125,14 +4125,15 @@ pub const Type = extern union {
|
||||
/// TODO this is deprecated in favor of `childType`.
|
||||
pub const elemType = childType;
|
||||
|
||||
/// For *[N]T, returns T.
|
||||
/// For ?*T, returns T.
|
||||
/// For ?*[N]T, returns T.
|
||||
/// For ?[*]T, returns T.
|
||||
/// For *T, returns T.
|
||||
/// For [*]T, returns T.
|
||||
/// For [N]T, returns T.
|
||||
/// For []T, returns T.
|
||||
/// For *[N]T, returns T.
|
||||
/// For ?*T, returns T.
|
||||
/// For ?*[N]T, returns T.
|
||||
/// For ?[*]T, returns T.
|
||||
/// For *T, returns T.
|
||||
/// For [*]T, returns T.
|
||||
/// For [N]T, returns T.
|
||||
/// For []T, returns T.
|
||||
/// For anyframe->T, returns T.
|
||||
pub fn elemType2(ty: Type) Type {
|
||||
return switch (ty.tag()) {
|
||||
.vector => ty.castTag(.vector).?.data.elem_type,
|
||||
@ -4173,6 +4174,9 @@ pub const Type = extern union {
|
||||
.optional_single_mut_pointer => ty.castPointer().?.data,
|
||||
.optional_single_const_pointer => ty.castPointer().?.data,
|
||||
|
||||
.anyframe_T => ty.castTag(.anyframe_T).?.data,
|
||||
.@"anyframe" => Type.@"void",
|
||||
|
||||
else => unreachable,
|
||||
};
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user