authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-03-22 22:00:03-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-03-22 22:00:03-07:00
log1cf1346323e05b1d481fd2fe0b20a79ed94d9360
treed0a88cc92c8c5533c368898602692a28b848c618
parent8326ab7adb92aff11d19b21a6d42869a361b462b

Sema: rename isArrayLike to isArrayOrVector


2 files changed, 3 insertions(+), 3 deletions(-)

src/Sema.zig+2-2
...@@ -18780,7 +18780,7 @@ fn beginComptimePtrLoad(...@@ -18780,7 +18780,7 @@ fn beginComptimePtrLoad(
1878018780
18781 // If we're loading an elem_ptr that was derived from a different type18781 // If we're loading an elem_ptr that was derived from a different type
18782 // than the true type of the underlying decl, we cannot deref directly18782 // than the true type of the underlying decl, we cannot deref directly
18783 const ty_matches = if (deref.pointee != null and deref.pointee.?.ty.isArrayLike()) x: {18783 const ty_matches = if (deref.pointee != null and deref.pointee.?.ty.isArrayOrVector()) x: {
18784 const deref_elem_ty = deref.pointee.?.ty.childType();18784 const deref_elem_ty = deref.pointee.?.ty.childType();
18785 break :x (try sema.coerceInMemoryAllowed(block, deref_elem_ty, elem_ty, false, target, src, src)) == .ok or18785 break :x (try sema.coerceInMemoryAllowed(block, deref_elem_ty, elem_ty, false, target, src, src)) == .ok or
18786 (try sema.coerceInMemoryAllowed(block, elem_ty, deref_elem_ty, false, target, src, src)) == .ok;18786 (try sema.coerceInMemoryAllowed(block, elem_ty, deref_elem_ty, false, target, src, src)) == .ok;
...@@ -18802,7 +18802,7 @@ fn beginComptimePtrLoad(...@@ -18802,7 +18802,7 @@ fn beginComptimePtrLoad(
18802 if (maybe_array_ty) |load_ty| {18802 if (maybe_array_ty) |load_ty| {
18803 // It's possible that we're loading a [N]T, in which case we'd like to slice18803 // It's possible that we're loading a [N]T, in which case we'd like to slice
18804 // the pointee array directly from our parent array.18804 // the pointee array directly from our parent array.
18805 if (load_ty.isArrayLike() and load_ty.childType().eql(elem_ty, target)) {18805 if (load_ty.isArrayOrVector() and load_ty.childType().eql(elem_ty, target)) {
18806 const N = try sema.usizeCast(block, src, load_ty.arrayLenIncludingSentinel());18806 const N = try sema.usizeCast(block, src, load_ty.arrayLenIncludingSentinel());
18807 deref.pointee = if (elem_ptr.index + N <= check_len) TypedValue{18807 deref.pointee = if (elem_ptr.index + N <= check_len) TypedValue{
18808 .ty = try Type.array(sema.arena, N, null, elem_ty, target),18808 .ty = try Type.array(sema.arena, N, null, elem_ty, target),
src/type.zig+1-1
...@@ -4734,7 +4734,7 @@ pub const Type = extern union {...@@ -4734,7 +4734,7 @@ pub const Type = extern union {
4734 };4734 };
4735 }4735 }
47364736
4737 pub fn isArrayLike(ty: Type) bool {4737 pub fn isArrayOrVector(ty: Type) bool {
4738 return switch (ty.zigTypeTag()) {4738 return switch (ty.zigTypeTag()) {
4739 .Array, .Vector => true,4739 .Array, .Vector => true,
4740 else => false,4740 else => false,