diff options
| author | Jacob Young <jacobly0@users.noreply.github.com> | 2022-10-29 05:58:41 -0400 |
|---|---|---|
| committer | Jacob Young <jacobly0@users.noreply.github.com> | 2022-10-29 05:58:41 -0400 |
| commit | 48a2783969b0a43200514a5b4e9cce57be4e5b46 (patch) | |
| tree | 0f7cc577dd9090938d842250e1d1986d3d05aa0e /src/AstGen.zig | |
| parent | e20d2b3151607fe078b43331ea27d5b34f95360b (diff) | |
| parent | 20925b2f5c5c0ae20fdc0574e5d4e5740d17b4d6 (diff) | |
| download | zig-48a2783969b0a43200514a5b4e9cce57be4e5b46.tar.gz zig-48a2783969b0a43200514a5b4e9cce57be4e5b46.zip | |
cbe: implement optional slice representation change
Diffstat (limited to 'src/AstGen.zig')
| -rw-r--r-- | src/AstGen.zig | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/AstGen.zig b/src/AstGen.zig index 07a972eaab..48e6a480f3 100644 --- a/src/AstGen.zig +++ b/src/AstGen.zig @@ -9709,7 +9709,7 @@ fn rvalue( const result_index = refToIndex(result) orelse return gz.addUnTok(.ref, result, src_token); const zir_tags = gz.astgen.instructions.items(.tag); - if (zir_tags[result_index].isParam()) + if (zir_tags[result_index].isParam() or astgen.isInferred(result)) return gz.addUnTok(.ref, result, src_token); const gop = try astgen.ref_table.getOrPut(astgen.gpa, result_index); if (!gop.found_existing) { @@ -12196,6 +12196,13 @@ fn isInferred(astgen: *AstGen, ref: Zir.Inst.Ref) bool { .alloc_inferred_comptime_mut, => true, + .extended => { + const zir_data = astgen.instructions.items(.data); + if (zir_data[inst].extended.opcode != .alloc) return false; + const small = @bitCast(Zir.Inst.AllocExtended.Small, zir_data[inst].extended.small); + return !small.has_type; + }, + else => false, }; } |
