authorgravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-06-03 14:28:10+03:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-06-03 14:28:10+03:00
log1258b5f7d6fc9b56379c2c671ed55286f7e5b663
tree067c16881d96a75ab76d6a411c99ddc0c0b23f48
parent9aae4d57cb6baf409b54d67a8a312624f8ad84b6

Type: implement elemType2 for anyframe


1 files changed, 13 insertions(+), 9 deletions(-)

src/type.zig+13-9
...@@ -784,7 +784,7 @@ pub const Type = extern union {...@@ -784,7 +784,7 @@ pub const Type = extern union {
784784
785 .anyframe_T => {785 .anyframe_T => {
786 if (b.zigTypeTag() != .AnyFrame) return false;786 if (b.zigTypeTag() != .AnyFrame) return false;
787 return a.childType().eql(b.childType(), mod);787 return a.elemType2().eql(b.elemType2(), mod);
788 },788 },
789789
790 .empty_struct => {790 .empty_struct => {
...@@ -4125,14 +4125,15 @@ pub const Type = extern union {...@@ -4125,14 +4125,15 @@ pub const Type = extern union {
4125 /// TODO this is deprecated in favor of `childType`.4125 /// TODO this is deprecated in favor of `childType`.
4126 pub const elemType = childType;4126 pub const elemType = childType;
41274127
4128 /// For *[N]T, returns T.4128 /// For *[N]T, returns T.
4129 /// For ?*T, returns T.4129 /// For ?*T, returns T.
4130 /// For ?*[N]T, returns T.4130 /// For ?*[N]T, returns T.
4131 /// For ?[*]T, returns T.4131 /// For ?[*]T, returns T.
4132 /// For *T, returns T.4132 /// For *T, returns T.
4133 /// For [*]T, returns T.4133 /// For [*]T, returns T.
4134 /// For [N]T, returns T.4134 /// For [N]T, returns T.
4135 /// For []T, returns T.4135 /// For []T, returns T.
4136 /// For anyframe->T, returns T.
4136 pub fn elemType2(ty: Type) Type {4137 pub fn elemType2(ty: Type) Type {
4137 return switch (ty.tag()) {4138 return switch (ty.tag()) {
4138 .vector => ty.castTag(.vector).?.data.elem_type,4139 .vector => ty.castTag(.vector).?.data.elem_type,
...@@ -4173,6 +4174,9 @@ pub const Type = extern union {...@@ -4173,6 +4174,9 @@ pub const Type = extern union {
4173 .optional_single_mut_pointer => ty.castPointer().?.data,4174 .optional_single_mut_pointer => ty.castPointer().?.data,
4174 .optional_single_const_pointer => ty.castPointer().?.data,4175 .optional_single_const_pointer => ty.castPointer().?.data,
41754176
4177 .anyframe_T => ty.castTag(.anyframe_T).?.data,
4178 .@"anyframe" => Type.@"void",
4179
4176 else => unreachable,4180 else => unreachable,
4177 };4181 };
4178 }4182 }