Sema: rename isArrayLike to isArrayOrVector

This commit is contained in:
Andrew Kelley 2022-03-22 22:00:03 -07:00
parent 8326ab7adb
commit 1cf1346323
2 changed files with 3 additions and 3 deletions

View File

@ -18780,7 +18780,7 @@ fn beginComptimePtrLoad(
// If we're loading an elem_ptr that was derived from a different type
// than the true type of the underlying decl, we cannot deref directly
const ty_matches = if (deref.pointee != null and deref.pointee.?.ty.isArrayLike()) x: {
const ty_matches = if (deref.pointee != null and deref.pointee.?.ty.isArrayOrVector()) x: {
const deref_elem_ty = deref.pointee.?.ty.childType();
break :x (try sema.coerceInMemoryAllowed(block, deref_elem_ty, elem_ty, false, target, src, src)) == .ok or
(try sema.coerceInMemoryAllowed(block, elem_ty, deref_elem_ty, false, target, src, src)) == .ok;
@ -18802,7 +18802,7 @@ fn beginComptimePtrLoad(
if (maybe_array_ty) |load_ty| {
// It's possible that we're loading a [N]T, in which case we'd like to slice
// the pointee array directly from our parent array.
if (load_ty.isArrayLike() and load_ty.childType().eql(elem_ty, target)) {
if (load_ty.isArrayOrVector() and load_ty.childType().eql(elem_ty, target)) {
const N = try sema.usizeCast(block, src, load_ty.arrayLenIncludingSentinel());
deref.pointee = if (elem_ptr.index + N <= check_len) TypedValue{
.ty = try Type.array(sema.arena, N, null, elem_ty, target),

View File

@ -4734,7 +4734,7 @@ pub const Type = extern union {
};
}
pub fn isArrayLike(ty: Type) bool {
pub fn isArrayOrVector(ty: Type) bool {
return switch (ty.zigTypeTag()) {
.Array, .Vector => true,
else => false,