diff options
| author | Veikka Tuominen <git@vexu.eu> | 2022-04-28 22:27:50 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-28 22:27:50 +0300 |
| commit | 091fe78337dc3ca340fdf74ca6c1a58c5e666626 (patch) | |
| tree | 3f29858b4c6425073e8c14c27d5355ef863f8074 /src/value.zig | |
| parent | 3052597a734f87727fa7f1a0e92247f100df3e96 (diff) | |
| parent | f8940a05aeb347deb858b848e33f73ef285c3298 (diff) | |
| download | zig-091fe78337dc3ca340fdf74ca6c1a58c5e666626.tar.gz zig-091fe78337dc3ca340fdf74ca6c1a58c5e666626.zip | |
Merge pull request #11541 from Vexu/stage2-slice-field-ptr
Stage2: fix slice field modification at comptime
Diffstat (limited to 'src/value.zig')
| -rw-r--r-- | src/value.zig | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/value.zig b/src/value.zig index d2de389de9..adfe4600f8 100644 --- a/src/value.zig +++ b/src/value.zig @@ -2539,6 +2539,15 @@ pub const Value = extern union { return 1; } }, + .decl_ref_mut => { + const decl_index = val.castTag(.decl_ref_mut).?.data.decl_index; + const decl = mod.declPtr(decl_index); + if (decl.ty.zigTypeTag() == .Array) { + return decl.ty.arrayLen(); + } else { + return 1; + } + }, else => unreachable, }; } @@ -5067,6 +5076,9 @@ pub const Value = extern union { ptr: Value, len: Value, }, + + pub const ptr_index = 0; + pub const len_index = 1; }; pub const Ty = struct { |
