diff options
| author | Veikka Tuominen <git@vexu.eu> | 2022-04-28 17:45:33 +0300 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-04-28 17:45:33 +0300 |
| commit | 095d51164f53ee7f23aae9dbe08270eacf61d97b (patch) | |
| tree | 6b281707a59612dce18c9584b413635efd3874eb /src/value.zig | |
| parent | 6f4343b61afe36a709e713735947561a2b76bce8 (diff) | |
| download | zig-095d51164f53ee7f23aae9dbe08270eacf61d97b.tar.gz zig-095d51164f53ee7f23aae9dbe08270eacf61d97b.zip | |
Sema: 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 bb7b742290..7cd19c5d25 100644 --- a/src/value.zig +++ b/src/value.zig @@ -2542,6 +2542,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, }; } @@ -5116,6 +5125,9 @@ pub const Value = extern union { ptr: Value, len: Value, }, + + pub const ptr_index = 0; + pub const len_index = 1; }; pub const Ty = struct { |
