diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-04-07 11:34:23 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-04-07 11:34:23 -0700 |
| commit | d9c25ec6720ecb0bc79fcab67659ee12ca6ad687 (patch) | |
| tree | 6ec9572a2d31ee93492a0746732308aa04b1a0dc /src/AstGen.zig | |
| parent | 4e8fb9e6a5f9a65bbf6469e386e83ba469e7543b (diff) | |
| download | zig-d9c25ec6720ecb0bc79fcab67659ee12ca6ad687.tar.gz zig-d9c25ec6720ecb0bc79fcab67659ee12ca6ad687.zip | |
zir: use `node` union field for `alloc_inferred`
Previously we used `un_node` and passed `undefined` for the operand, but
this causes illegal behavior when printing ZIR code.
Diffstat (limited to 'src/AstGen.zig')
| -rw-r--r-- | src/AstGen.zig | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/AstGen.zig b/src/AstGen.zig index af9938d425..d6c2eea5a3 100644 --- a/src/AstGen.zig +++ b/src/AstGen.zig @@ -1484,7 +1484,7 @@ fn varDecl( init_scope.rl_ptr = try init_scope.addUnNode(.alloc, type_inst, node); init_scope.rl_ty_inst = type_inst; } else { - const alloc = try init_scope.addUnNode(.alloc_inferred, undefined, node); + const alloc = try init_scope.addNode(.alloc_inferred, node); resolve_inferred_alloc = alloc; init_scope.rl_ptr = alloc; } @@ -1559,7 +1559,7 @@ fn varDecl( const alloc = try gz.addUnNode(.alloc_mut, type_inst, node); break :a .{ .alloc = alloc, .result_loc = .{ .ptr = alloc } }; } else a: { - const alloc = try gz.addUnNode(.alloc_inferred_mut, undefined, node); + const alloc = try gz.addNode(.alloc_inferred_mut, node); resolve_inferred_alloc = alloc; break :a .{ .alloc = alloc, .result_loc = .{ .inferred_ptr = alloc } }; }; |
