| author | |
| committer | |
| log | d9c25ec6720ecb0bc79fcab67659ee12ca6ad687 |
| tree | 6ec9572a2d31ee93492a0746732308aa04b1a0dc |
| parent | 4e8fb9e6a5f9a65bbf6469e386e83ba469e7543b |
Previously we used `un_node` and passed `undefined` for the operand, but
this causes illegal behavior when printing ZIR code.3 files changed, 7 insertions(+), 7 deletions(-)
src/AstGen.zig+2-2| ... | ... | @@ -1484,7 +1484,7 @@ fn varDecl( |
| 1484 | 1484 | init_scope.rl_ptr = try init_scope.addUnNode(.alloc, type_inst, node); |
| 1485 | 1485 | init_scope.rl_ty_inst = type_inst; |
| 1486 | 1486 | } else { |
| 1487 | const alloc = try init_scope.addUnNode(.alloc_inferred, undefined, node); | |
| 1487 | const alloc = try init_scope.addNode(.alloc_inferred, node); | |
| 1488 | 1488 | resolve_inferred_alloc = alloc; |
| 1489 | 1489 | init_scope.rl_ptr = alloc; |
| 1490 | 1490 | } |
| ... | ... | @@ -1559,7 +1559,7 @@ fn varDecl( |
| 1559 | 1559 | const alloc = try gz.addUnNode(.alloc_mut, type_inst, node); |
| 1560 | 1560 | break :a .{ .alloc = alloc, .result_loc = .{ .ptr = alloc } }; |
| 1561 | 1561 | } else a: { |
| 1562 | const alloc = try gz.addUnNode(.alloc_inferred_mut, undefined, node); | |
| 1562 | const alloc = try gz.addNode(.alloc_inferred_mut, node); | |
| 1563 | 1563 | resolve_inferred_alloc = alloc; |
| 1564 | 1564 | break :a .{ .alloc = alloc, .result_loc = .{ .inferred_ptr = alloc } }; |
| 1565 | 1565 | }; |
src/Sema.zig+2-2| ... | ... | @@ -785,8 +785,8 @@ fn zirAllocInferred( |
| 785 | 785 | const tracy = trace(@src()); |
| 786 | 786 | defer tracy.end(); |
| 787 | 787 | |
| 788 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | |
| 789 | const src = inst_data.src(); | |
| 788 | const src_node = sema.code.instructions.items(.data)[inst].node; | |
| 789 | const src: LazySrcLoc = .{ .node_offset = src_node }; | |
| 790 | 790 | |
| 791 | 791 | const val_payload = try sema.arena.create(Value.Payload.InferredAlloc); |
| 792 | 792 | val_payload.* = .{ |
src/zir.zig+3-3| ... | ... | @@ -130,7 +130,7 @@ pub const Inst = struct { |
| 130 | 130 | /// Same as `alloc` except mutable. |
| 131 | 131 | alloc_mut, |
| 132 | 132 | /// Same as `alloc` except the type is inferred. |
| 133 | /// The operand is unused. | |
| 133 | /// Uses the `node` union field. | |
| 134 | 134 | alloc_inferred, |
| 135 | 135 | /// Same as `alloc_inferred` except mutable. |
| 136 | 136 | alloc_inferred_mut, |
| ... | ... | @@ -1577,8 +1577,6 @@ const Writer = struct { |
| 1577 | 1577 | |
| 1578 | 1578 | .alloc, |
| 1579 | 1579 | .alloc_mut, |
| 1580 | .alloc_inferred, | |
| 1581 | .alloc_inferred_mut, | |
| 1582 | 1580 | .indexable_ptr_len, |
| 1583 | 1581 | .bit_not, |
| 1584 | 1582 | .bool_not, |
| ... | ... | @@ -1745,6 +1743,8 @@ const Writer = struct { |
| 1745 | 1743 | .ret_type, |
| 1746 | 1744 | .repeat, |
| 1747 | 1745 | .repeat_inline, |
| 1746 | .alloc_inferred, | |
| 1747 | .alloc_inferred_mut, | |
| 1748 | 1748 | => try self.writeNode(stream, inst), |
| 1749 | 1749 | |
| 1750 | 1750 | .error_value, |