| ... | @@ -2696,6 +2696,7 @@ fn genDefers( | ... | @@ -2696,6 +2696,7 @@ fn genDefers( |
| 2696 | break :blk &local_val_scope.base; | 2696 | break :blk &local_val_scope.base; |
| 2697 | }; | 2697 | }; |
| 2698 | try unusedResultDeferExpr(gz, defer_scope, sub_scope, expr_node); | 2698 | try unusedResultDeferExpr(gz, defer_scope, sub_scope, expr_node); |
| | 2699 | try checkUsed(gz, scope, sub_scope); |
| 2699 | try gz.addDbgBlockEnd(); | 2700 | try gz.addDbgBlockEnd(); |
| 2700 | }, | 2701 | }, |
| 2701 | .normal_only => continue, | 2702 | .normal_only => continue, |
| ... | @@ -5384,7 +5385,7 @@ fn ifExpr( | ... | @@ -5384,7 +5385,7 @@ fn ifExpr( |
| 5384 | const tag: Zir.Inst.Tag = if (payload_is_ref) .is_non_err_ptr else .is_non_err; | 5385 | const tag: Zir.Inst.Tag = if (payload_is_ref) .is_non_err_ptr else .is_non_err; |
| 5385 | break :c .{ | 5386 | break :c .{ |
| 5386 | .inst = err_union, | 5387 | .inst = err_union, |
| 5387 | .bool_bit = try block_scope.addUnNode(tag, err_union, node), | 5388 | .bool_bit = try block_scope.addUnNode(tag, err_union, if_full.ast.cond_expr), |
| 5388 | }; | 5389 | }; |
| 5389 | } else if (if_full.payload_token) |_| { | 5390 | } else if (if_full.payload_token) |_| { |
| 5390 | const cond_rl: ResultLoc = if (payload_is_ref) .ref else .none; | 5391 | const cond_rl: ResultLoc = if (payload_is_ref) .ref else .none; |
| ... | @@ -5392,7 +5393,7 @@ fn ifExpr( | ... | @@ -5392,7 +5393,7 @@ fn ifExpr( |
| 5392 | const tag: Zir.Inst.Tag = if (payload_is_ref) .is_non_null_ptr else .is_non_null; | 5393 | const tag: Zir.Inst.Tag = if (payload_is_ref) .is_non_null_ptr else .is_non_null; |
| 5393 | break :c .{ | 5394 | break :c .{ |
| 5394 | .inst = optional, | 5395 | .inst = optional, |
| 5395 | .bool_bit = try block_scope.addUnNode(tag, optional, node), | 5396 | .bool_bit = try block_scope.addUnNode(tag, optional, if_full.ast.cond_expr), |
| 5396 | }; | 5397 | }; |
| 5397 | } else { | 5398 | } else { |
| 5398 | const cond = try expr(&block_scope, &block_scope.base, bool_rl, if_full.ast.cond_expr); | 5399 | const cond = try expr(&block_scope, &block_scope.base, bool_rl, if_full.ast.cond_expr); |
| ... | @@ -5423,7 +5424,7 @@ fn ifExpr( | ... | @@ -5423,7 +5424,7 @@ fn ifExpr( |
| 5423 | .err_union_payload_unsafe_ptr | 5424 | .err_union_payload_unsafe_ptr |
| 5424 | else | 5425 | else |
| 5425 | .err_union_payload_unsafe; | 5426 | .err_union_payload_unsafe; |
| 5426 | const payload_inst = try then_scope.addUnNode(tag, cond.inst, node); | 5427 | const payload_inst = try then_scope.addUnNode(tag, cond.inst, if_full.ast.then_expr); |
| 5427 | const token_name_index = payload_token + @boolToInt(payload_is_ref); | 5428 | const token_name_index = payload_token + @boolToInt(payload_is_ref); |
| 5428 | const ident_name = try astgen.identAsString(token_name_index); | 5429 | const ident_name = try astgen.identAsString(token_name_index); |
| 5429 | const token_name_str = tree.tokenSlice(token_name_index); | 5430 | const token_name_str = tree.tokenSlice(token_name_index); |
| ... | @@ -5452,7 +5453,7 @@ fn ifExpr( | ... | @@ -5452,7 +5453,7 @@ fn ifExpr( |
| 5452 | const ident_bytes = tree.tokenSlice(ident_token); | 5453 | const ident_bytes = tree.tokenSlice(ident_token); |
| 5453 | if (mem.eql(u8, "_", ident_bytes)) | 5454 | if (mem.eql(u8, "_", ident_bytes)) |
| 5454 | break :s &then_scope.base; | 5455 | break :s &then_scope.base; |
| 5455 | const payload_inst = try then_scope.addUnNode(tag, cond.inst, node); | 5456 | const payload_inst = try then_scope.addUnNode(tag, cond.inst, if_full.ast.then_expr); |
| 5456 | const ident_name = try astgen.identAsString(ident_token); | 5457 | const ident_name = try astgen.identAsString(ident_token); |
| 5457 | try astgen.detectLocalShadowing(&then_scope.base, ident_name, ident_token, ident_bytes); | 5458 | try astgen.detectLocalShadowing(&then_scope.base, ident_name, ident_token, ident_bytes); |
| 5458 | payload_val_scope = .{ | 5459 | payload_val_scope = .{ |
| ... | @@ -5495,7 +5496,7 @@ fn ifExpr( | ... | @@ -5495,7 +5496,7 @@ fn ifExpr( |
| 5495 | .err_union_code_ptr | 5496 | .err_union_code_ptr |
| 5496 | else | 5497 | else |
| 5497 | .err_union_code; | 5498 | .err_union_code; |
| 5498 | const payload_inst = try else_scope.addUnNode(tag, cond.inst, node); | 5499 | const payload_inst = try else_scope.addUnNode(tag, cond.inst, if_full.ast.cond_expr); |
| 5499 | const ident_name = try astgen.identAsString(error_token); | 5500 | const ident_name = try astgen.identAsString(error_token); |
| 5500 | const error_token_str = tree.tokenSlice(error_token); | 5501 | const error_token_str = tree.tokenSlice(error_token); |
| 5501 | if (mem.eql(u8, "_", error_token_str)) | 5502 | if (mem.eql(u8, "_", error_token_str)) |
| ... | @@ -5709,7 +5710,7 @@ fn whileExpr( | ... | @@ -5709,7 +5710,7 @@ fn whileExpr( |
| 5709 | const tag: Zir.Inst.Tag = if (payload_is_ref) .is_non_err_ptr else .is_non_err; | 5710 | const tag: Zir.Inst.Tag = if (payload_is_ref) .is_non_err_ptr else .is_non_err; |
| 5710 | break :c .{ | 5711 | break :c .{ |
| 5711 | .inst = err_union, | 5712 | .inst = err_union, |
| 5712 | .bool_bit = try continue_scope.addUnNode(tag, err_union, node), | 5713 | .bool_bit = try continue_scope.addUnNode(tag, err_union, while_full.ast.then_expr), |
| 5713 | }; | 5714 | }; |
| 5714 | } else if (while_full.payload_token) |_| { | 5715 | } else if (while_full.payload_token) |_| { |
| 5715 | const cond_rl: ResultLoc = if (payload_is_ref) .ref else .none; | 5716 | const cond_rl: ResultLoc = if (payload_is_ref) .ref else .none; |
| ... | @@ -5717,7 +5718,7 @@ fn whileExpr( | ... | @@ -5717,7 +5718,7 @@ fn whileExpr( |
| 5717 | const tag: Zir.Inst.Tag = if (payload_is_ref) .is_non_null_ptr else .is_non_null; | 5718 | const tag: Zir.Inst.Tag = if (payload_is_ref) .is_non_null_ptr else .is_non_null; |
| 5718 | break :c .{ | 5719 | break :c .{ |
| 5719 | .inst = optional, | 5720 | .inst = optional, |
| 5720 | .bool_bit = try continue_scope.addUnNode(tag, optional, node), | 5721 | .bool_bit = try continue_scope.addUnNode(tag, optional, while_full.ast.then_expr), |
| 5721 | }; | 5722 | }; |
| 5722 | } else { | 5723 | } else { |
| 5723 | const cond = try expr(&continue_scope, &continue_scope.base, bool_rl, while_full.ast.cond_expr); | 5724 | const cond = try expr(&continue_scope, &continue_scope.base, bool_rl, while_full.ast.cond_expr); |
| ... | @@ -5755,7 +5756,7 @@ fn whileExpr( | ... | @@ -5755,7 +5756,7 @@ fn whileExpr( |
| 5755 | else | 5756 | else |
| 5756 | .err_union_payload_unsafe; | 5757 | .err_union_payload_unsafe; |
| 5757 | // will add this instruction to then_scope.instructions below | 5758 | // will add this instruction to then_scope.instructions below |
| 5758 | payload_inst = try then_scope.makeUnNode(tag, cond.inst, node); | 5759 | payload_inst = try then_scope.makeUnNode(tag, cond.inst, while_full.ast.cond_expr); |
| 5759 | const ident_token = if (payload_is_ref) payload_token + 1 else payload_token; | 5760 | const ident_token = if (payload_is_ref) payload_token + 1 else payload_token; |
| 5760 | const ident_bytes = tree.tokenSlice(ident_token); | 5761 | const ident_bytes = tree.tokenSlice(ident_token); |
| 5761 | if (mem.eql(u8, "_", ident_bytes)) | 5762 | if (mem.eql(u8, "_", ident_bytes)) |
| ... | @@ -5784,7 +5785,7 @@ fn whileExpr( | ... | @@ -5784,7 +5785,7 @@ fn whileExpr( |
| 5784 | else | 5785 | else |
| 5785 | .optional_payload_unsafe; | 5786 | .optional_payload_unsafe; |
| 5786 | // will add this instruction to then_scope.instructions below | 5787 | // will add this instruction to then_scope.instructions below |
| 5787 | payload_inst = try then_scope.makeUnNode(tag, cond.inst, node); | 5788 | payload_inst = try then_scope.makeUnNode(tag, cond.inst, while_full.ast.cond_expr); |
| 5788 | const ident_name = try astgen.identAsString(ident_token); | 5789 | const ident_name = try astgen.identAsString(ident_token); |
| 5789 | const ident_bytes = tree.tokenSlice(ident_token); | 5790 | const ident_bytes = tree.tokenSlice(ident_token); |
| 5790 | if (mem.eql(u8, "_", ident_bytes)) | 5791 | if (mem.eql(u8, "_", ident_bytes)) |
| ... | @@ -5860,7 +5861,7 @@ fn whileExpr( | ... | @@ -5860,7 +5861,7 @@ fn whileExpr( |
| 5860 | .err_union_code_ptr | 5861 | .err_union_code_ptr |
| 5861 | else | 5862 | else |
| 5862 | .err_union_code; | 5863 | .err_union_code; |
| 5863 | const else_payload_inst = try else_scope.addUnNode(tag, cond.inst, node); | 5864 | const else_payload_inst = try else_scope.addUnNode(tag, cond.inst, while_full.ast.cond_expr); |
| 5864 | const ident_name = try astgen.identAsString(error_token); | 5865 | const ident_name = try astgen.identAsString(error_token); |
| 5865 | const ident_bytes = tree.tokenSlice(error_token); | 5866 | const ident_bytes = tree.tokenSlice(error_token); |
| 5866 | if (mem.eql(u8, ident_bytes, "_")) | 5867 | if (mem.eql(u8, ident_bytes, "_")) |