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 {
784784
785785 .anyframe_T => {
786786 if (b.zigTypeTag() != .AnyFrame) return false;
787 return a.childType().eql(b.childType(), mod);
787 return a.elemType2().eql(b.elemType2(), mod);
788788 },
789789
790790 .empty_struct => {
......@@ -4125,14 +4125,15 @@ pub const Type = extern union {
41254125 /// TODO this is deprecated in favor of `childType`.
41264126 pub const elemType = childType;
41274127
4128 /// For *[N]T, returns T.
4129 /// For ?*T, returns T.
4130 /// For ?*[N]T, returns T.
4131 /// For ?[*]T, returns T.
4132 /// For *T, returns T.
4133 /// For [*]T, returns T.
4134 /// For [N]T, returns T.
4135 /// For []T, returns T.
4128 /// For *[N]T, returns T.
4129 /// For ?*T, returns T.
4130 /// For ?*[N]T, returns T.
4131 /// For ?[*]T, returns T.
4132 /// For *T, returns T.
4133 /// For [*]T, returns T.
4134 /// For [N]T, returns T.
4135 /// For []T, returns T.
4136 /// For anyframe->T, returns T.
41364137 pub fn elemType2(ty: Type) Type {
41374138 return switch (ty.tag()) {
41384139 .vector => ty.castTag(.vector).?.data.elem_type,
......@@ -4173,6 +4174,9 @@ pub const Type = extern union {
41734174 .optional_single_mut_pointer => ty.castPointer().?.data,
41744175 .optional_single_const_pointer => ty.castPointer().?.data,
41754176
4177 .anyframe_T => ty.castTag(.anyframe_T).?.data,
4178 .@"anyframe" => Type.@"void",
4179
41764180 else => unreachable,
41774181 };
41784182 }