| ... | ... | @@ -4891,7 +4891,7 @@ fn orelseCatchExpr( |
| 4891 | 4891 | // We cannot use `block_scope.break_result_loc` because that has the bare |
| 4892 | 4892 | // type, whereas this expression has the optional type. Later we make |
| 4893 | 4893 | // up for this fact by calling rvalue on the else branch. |
| 4894 | | const operand = try expr(&block_scope, &block_scope.base, operand_rl, lhs); |
| 4894 | const operand = try reachableExpr(&block_scope, &block_scope.base, operand_rl, lhs, rhs); |
| 4895 | 4895 | const cond = try block_scope.addUnNode(cond_op, operand, node); |
| 4896 | 4896 | const condbr = try block_scope.addCondBr(.condbr, node); |
| 4897 | 4897 | |
| ... | ... | @@ -4930,8 +4930,10 @@ fn orelseCatchExpr( |
| 4930 | 4930 | break :blk &err_val_scope.base; |
| 4931 | 4931 | }; |
| 4932 | 4932 | |
| 4933 | | block_scope.break_count += 1; |
| 4934 | 4933 | const else_result = try expr(&else_scope, else_sub_scope, block_scope.break_result_loc, rhs); |
| 4934 | if (!else_scope.endsWithNoReturn()) { |
| 4935 | block_scope.break_count += 1; |
| 4936 | } |
| 4935 | 4937 | try checkUsed(parent_gz, &else_scope.base, else_sub_scope); |
| 4936 | 4938 | |
| 4937 | 4939 | // We hold off on the break instructions as well as copying the then/else |
| ... | ... | @@ -5249,8 +5251,10 @@ fn ifExpr( |
| 5249 | 5251 | } |
| 5250 | 5252 | }; |
| 5251 | 5253 | |
| 5252 | | block_scope.break_count += 1; |
| 5253 | 5254 | const then_result = try expr(&then_scope, then_sub_scope, block_scope.break_result_loc, if_full.ast.then_expr); |
| 5255 | if (!then_scope.endsWithNoReturn()) { |
| 5256 | block_scope.break_count += 1; |
| 5257 | } |
| 5254 | 5258 | try checkUsed(parent_gz, &then_scope.base, then_sub_scope); |
| 5255 | 5259 | // We hold off on the break instructions as well as copying the then/else |
| 5256 | 5260 | // instructions into place until we know whether to keep store_to_block_ptr |
| ... | ... | @@ -5264,7 +5268,6 @@ fn ifExpr( |
| 5264 | 5268 | src: Ast.Node.Index, |
| 5265 | 5269 | result: Zir.Inst.Ref, |
| 5266 | 5270 | } = if (else_node != 0) blk: { |
| 5267 | | block_scope.break_count += 1; |
| 5268 | 5271 | const sub_scope = s: { |
| 5269 | 5272 | if (if_full.error_token) |error_token| { |
| 5270 | 5273 | const tag: Zir.Inst.Tag = if (payload_is_ref) |
| ... | ... | @@ -5291,6 +5294,9 @@ fn ifExpr( |
| 5291 | 5294 | } |
| 5292 | 5295 | }; |
| 5293 | 5296 | const e = try expr(&else_scope, sub_scope, block_scope.break_result_loc, else_node); |
| 5297 | if (!else_scope.endsWithNoReturn()) { |
| 5298 | block_scope.break_count += 1; |
| 5299 | } |
| 5294 | 5300 | try checkUsed(parent_gz, &else_scope.base, sub_scope); |
| 5295 | 5301 | break :blk .{ |
| 5296 | 5302 | .src = else_node, |