| ... | @@ -7624,26 +7624,27 @@ static IrInstruction *ir_gen_catch(IrBuilder *irb, Scope *parent_scope, AstNode | ... | @@ -7624,26 +7624,27 @@ static IrInstruction *ir_gen_catch(IrBuilder *irb, Scope *parent_scope, AstNode |
| 7624 | is_comptime); | 7624 | is_comptime); |
| 7625 | | 7625 | |
| 7626 | ir_set_cursor_at_end_and_append_block(irb, err_block); | 7626 | ir_set_cursor_at_end_and_append_block(irb, err_block); |
| | 7627 | Scope *subexpr_scope = create_runtime_scope(irb->codegen, node, parent_scope, is_comptime); |
| 7627 | Scope *err_scope; | 7628 | Scope *err_scope; |
| 7628 | if (var_node) { | 7629 | if (var_node) { |
| 7629 | assert(var_node->type == NodeTypeSymbol); | 7630 | assert(var_node->type == NodeTypeSymbol); |
| 7630 | Buf *var_name = var_node->data.symbol_expr.symbol; | 7631 | Buf *var_name = var_node->data.symbol_expr.symbol; |
| 7631 | bool is_const = true; | 7632 | bool is_const = true; |
| 7632 | bool is_shadowable = false; | 7633 | bool is_shadowable = false; |
| 7633 | ZigVar *var = ir_create_var(irb, node, parent_scope, var_name, | 7634 | ZigVar *var = ir_create_var(irb, node, subexpr_scope, var_name, |
| 7634 | is_const, is_const, is_shadowable, is_comptime); | 7635 | is_const, is_const, is_shadowable, is_comptime); |
| 7635 | err_scope = var->child_scope; | 7636 | err_scope = var->child_scope; |
| 7636 | IrInstruction *err_ptr = ir_build_unwrap_err_code(irb, err_scope, node, err_union_ptr); | 7637 | IrInstruction *err_ptr = ir_build_unwrap_err_code(irb, err_scope, node, err_union_ptr); |
| 7637 | ir_build_var_decl_src(irb, err_scope, var_node, var, nullptr, err_ptr); | 7638 | ir_build_var_decl_src(irb, err_scope, var_node, var, nullptr, err_ptr); |
| 7638 | } else { | 7639 | } else { |
| 7639 | err_scope = parent_scope; | 7640 | err_scope = subexpr_scope; |
| 7640 | } | 7641 | } |
| 7641 | IrInstruction *err_result = ir_gen_node_extra(irb, op2_node, err_scope, LValNone, &peer_parent->peers.at(0)->base); | 7642 | IrInstruction *err_result = ir_gen_node_extra(irb, op2_node, err_scope, LValNone, &peer_parent->peers.at(0)->base); |
| 7642 | if (err_result == irb->codegen->invalid_instruction) | 7643 | if (err_result == irb->codegen->invalid_instruction) |
| 7643 | return irb->codegen->invalid_instruction; | 7644 | return irb->codegen->invalid_instruction; |
| 7644 | IrBasicBlock *after_err_block = irb->current_basic_block; | 7645 | IrBasicBlock *after_err_block = irb->current_basic_block; |
| 7645 | if (!instr_is_unreachable(err_result)) | 7646 | if (!instr_is_unreachable(err_result)) |
| 7646 | ir_mark_gen(ir_build_br(irb, err_scope, node, end_block, is_comptime)); | 7647 | ir_mark_gen(ir_build_br(irb, parent_scope, node, end_block, is_comptime)); |
| 7647 | | 7648 | |
| 7648 | ir_set_cursor_at_end_and_append_block(irb, ok_block); | 7649 | ir_set_cursor_at_end_and_append_block(irb, ok_block); |
| 7649 | IrInstruction *unwrapped_ptr = ir_build_unwrap_err_payload(irb, parent_scope, node, err_union_ptr, false, false); | 7650 | IrInstruction *unwrapped_ptr = ir_build_unwrap_err_payload(irb, parent_scope, node, err_union_ptr, false, false); |