diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-03-22 22:00:03 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-03-22 22:00:03 -0700 |
| commit | 1cf1346323e05b1d481fd2fe0b20a79ed94d9360 (patch) | |
| tree | d0a88cc92c8c5533c368898602692a28b848c618 /src | |
| parent | 8326ab7adb92aff11d19b21a6d42869a361b462b (diff) | |
| download | zig-1cf1346323e05b1d481fd2fe0b20a79ed94d9360.tar.gz zig-1cf1346323e05b1d481fd2fe0b20a79ed94d9360.zip | |
Sema: rename isArrayLike to isArrayOrVector
Diffstat (limited to 'src')
| -rw-r--r-- | src/Sema.zig | 4 | ||||
| -rw-r--r-- | src/type.zig | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/Sema.zig b/src/Sema.zig index dd9f2d74d8..ab73c55369 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -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), diff --git a/src/type.zig b/src/type.zig index 8668b36dca..d5b8e6f5b3 100644 --- a/src/type.zig +++ b/src/type.zig @@ -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, |
