diff options
| author | Veikka Tuominen <git@vexu.eu> | 2022-02-27 13:32:55 +0200 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-02-27 13:32:55 +0200 |
| commit | 7a92b89a9d19f3e6d258c848f1be13a6e31fec97 (patch) | |
| tree | 24c8172ece3a13981189b7bef2d4665c118cd0e6 /src/AstGen.zig | |
| parent | 813f368a3c44133106584b0d7e30748cff79a776 (diff) | |
| download | zig-7a92b89a9d19f3e6d258c848f1be13a6e31fec97.tar.gz zig-7a92b89a9d19f3e6d258c848f1be13a6e31fec97.zip | |
stage2: forward discard result loc to more expressions
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 b9ac0b5c43..e8d612fbc7 100644 --- a/src/AstGen.zig +++ b/src/AstGen.zig @@ -244,10 +244,14 @@ pub const ResultLoc = union(enum) { fn strategy(rl: ResultLoc, block_scope: *GenZir) Strategy { switch (rl) { // In this branch there will not be any store_to_block_ptr instructions. - .discard, .none, .ty, .coerced_ty, .ref => return .{ + .none, .ty, .coerced_ty, .ref => return .{ .tag = .break_operand, .elide_store_to_block_ptr_instructions = false, }, + .discard => return .{ + .tag = .break_void, + .elide_store_to_block_ptr_instructions = false, + }, // The pointer got passed through to the sub-expressions, so we will use // break_void here. // In this branch there will not be any store_to_block_ptr instructions. @@ -1766,6 +1770,9 @@ fn breakExpr(parent_gz: *GenZir, parent_scope: *Scope, node: Ast.Node.Index) Inn // we assume the result location is written, and we break with void. _ = try parent_gz.addBreak(break_tag, block_inst, .void_value); }, + .discard => { + _ = try parent_gz.addBreak(break_tag, block_inst, .void_value); + }, else => { _ = try parent_gz.addBreak(break_tag, block_inst, operand); }, |
