aboutsummaryrefslogtreecommitdiff
path: root/src/value.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-03-14 21:11:49 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-03-14 21:43:03 -0700
commit2f92d1a0264b6827cb67a55726c4c9a082337508 (patch)
treed6691a25a828b44cb4c17365fb8549d339046810 /src/value.zig
parent50a1ca24ca2a4311097132d660b8244f252da82f (diff)
downloadzig-2f92d1a0264b6827cb67a55726c4c9a082337508.tar.gz
zig-2f92d1a0264b6827cb67a55726c4c9a082337508.zip
stage2: fixups for topolarity-comptime-memory-reinterp branch
* don't store `has_well_defined_layout` in memory. * remove struct `hasWellDefinedLayout` logic. it's just `layout != .Auto`. This means we only need one implementation, in Type. * fix some of the cases being wrong in `hasWellDefinedLayout`, such as optional pointers. * move `tag_ty_inferred` field into a position that makes it more obvious how the struct layout will be done. Also we don't have a compiler that intelligently moves fields around so this layout is better. * Sema: don't `resolveTypeLayout` in `zirCoerceResultPtr` unless necessary. * Rename `ComptimePtrLoadKit` `target` field to `pointee` to avoid confusion with `target`.
Diffstat (limited to 'src/value.zig')
-rw-r--r--src/value.zig4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/value.zig b/src/value.zig
index af5ee75737..24cec0396e 100644
--- a/src/value.zig
+++ b/src/value.zig
@@ -2417,7 +2417,7 @@ pub const Value = extern union {
return switch (val.tag()) {
.empty_array_sentinel => if (start == 0 and end == 1) val else Value.initTag(.empty_array),
.bytes => Tag.bytes.create(arena, val.castTag(.bytes).?.data[start..end]),
- .array => Tag.array.create(arena, val.castTag(.array).?.data[start..end]),
+ .aggregate => Tag.aggregate.create(arena, val.castTag(.aggregate).?.data[start..end]),
.slice => sliceArray(val.castTag(.slice).?.data.ptr, arena, start, end),
.decl_ref => sliceArray(val.castTag(.decl_ref).?.data.val, arena, start, end),
@@ -2466,7 +2466,7 @@ pub const Value = extern union {
pub fn elemPtr(val: Value, ty: Type, arena: Allocator, index: usize) Allocator.Error!Value {
const elem_ty = ty.elemType2();
const ptr_val = switch (val.tag()) {
- .slice => val.slicePtr(),
+ .slice => val.castTag(.slice).?.data.ptr,
else => val,
};