diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-06-21 18:21:12 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-06-21 18:21:12 -0400 |
| commit | 727af307c62d33f7bd9ee9ce45b81481a9479b86 (patch) | |
| tree | d2e99592ede567f4a196be34100475d759ae650b /src/ir.cpp | |
| parent | ff6d563b0455aea51775e6906f5e7f0dd67b7127 (diff) | |
| download | zig-727af307c62d33f7bd9ee9ce45b81481a9479b86.tar.gz zig-727af307c62d33f7bd9ee9ce45b81481a9479b86.zip | |
fix return result loc and then switch with range...
...implicit casted to error union
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index a6ec836a40..08253e7487 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -7115,8 +7115,11 @@ static IrInstruction *ir_gen_switch_expr(IrBuilder *irb, Scope *scope, AstNode * assert(ok_bit); assert(last_item_node); - ir_mark_gen(ir_build_cond_br(irb, scope, last_item_node, ok_bit, range_block_yes, - range_block_no, is_comptime)); + IrInstruction *br_inst = ir_mark_gen(ir_build_cond_br(irb, scope, last_item_node, ok_bit, + range_block_yes, range_block_no, is_comptime)); + if (peer_parent->base.source_instruction == nullptr) { + peer_parent->base.source_instruction = br_inst; + } if (peer_parent->peers.length > 0) { peer_parent->peers.last()->next_bb = range_block_yes; @@ -7198,10 +7201,12 @@ static IrInstruction *ir_gen_switch_expr(IrBuilder *irb, Scope *scope, AstNode * } br_instruction = &switch_br->base; } + if (peer_parent->base.source_instruction == nullptr) { + peer_parent->base.source_instruction = br_instruction; + } for (size_t i = 0; i < peer_parent->peers.length; i += 1) { - peer_parent->peers.at(i)->base.source_instruction = br_instruction; + peer_parent->peers.at(i)->base.source_instruction = peer_parent->base.source_instruction; } - peer_parent->base.source_instruction = br_instruction; if (!else_prong) { if (peer_parent->peers.length != 0) { |
