| ... | @@ -2051,6 +2051,18 @@ static IrInstruction *ir_build_check_switch_prongs(IrBuilder *irb, Scope *scope, | ... | @@ -2051,6 +2051,18 @@ static IrInstruction *ir_build_check_switch_prongs(IrBuilder *irb, Scope *scope, |
| 2051 | return &instruction->base; | 2051 | return &instruction->base; |
| 2052 | } | 2052 | } |
| 2053 | | 2053 | |
| | 2054 | static IrInstruction *ir_build_check_statement_is_void(IrBuilder *irb, Scope *scope, AstNode *source_node, |
| | 2055 | IrInstruction* statement_value) |
| | 2056 | { |
| | 2057 | IrInstructionCheckStatementIsVoid *instruction = ir_build_instruction<IrInstructionCheckStatementIsVoid>( |
| | 2058 | irb, scope, source_node); |
| | 2059 | instruction->statement_value = statement_value; |
| | 2060 | |
| | 2061 | ir_ref_instruction(statement_value, irb->current_basic_block); |
| | 2062 | |
| | 2063 | return &instruction->base; |
| | 2064 | } |
| | 2065 | |
| 2054 | static IrInstruction *ir_build_test_type(IrBuilder *irb, Scope *scope, AstNode *source_node, | 2066 | static IrInstruction *ir_build_test_type(IrBuilder *irb, Scope *scope, AstNode *source_node, |
| 2055 | IrInstruction *type_value, TypeTableEntryId type_id) | 2067 | IrInstruction *type_value, TypeTableEntryId type_id) |
| 2056 | { | 2068 | { |
| ... | @@ -3139,7 +3151,11 @@ static bool ir_gen_defers_for_block(IrBuilder *irb, Scope *inner_scope, Scope *o | ... | @@ -3139,7 +3151,11 @@ static bool ir_gen_defers_for_block(IrBuilder *irb, Scope *inner_scope, Scope *o |
| 3139 | (gen_error_defers && defer_kind == ReturnKindError)) | 3151 | (gen_error_defers && defer_kind == ReturnKindError)) |
| 3140 | { | 3152 | { |
| 3141 | AstNode *defer_expr_node = defer_node->data.defer.expr; | 3153 | AstNode *defer_expr_node = defer_node->data.defer.expr; |
| 3142 | ir_gen_node(irb, defer_expr_node, defer_node->data.defer.expr_scope); | 3154 | Scope *defer_expr_scope = defer_node->data.defer.expr_scope; |
| | 3155 | IrInstruction *defer_expr_value = ir_gen_node(irb, defer_expr_node, defer_expr_scope); |
| | 3156 | if (defer_expr_value != irb->codegen->invalid_instruction) { |
| | 3157 | ir_mark_gen(ir_build_check_statement_is_void(irb, defer_expr_scope, defer_expr_node, defer_expr_value)); |
| | 3158 | } |
| 3143 | } | 3159 | } |
| 3144 | | 3160 | |
| 3145 | } | 3161 | } |
| ... | @@ -3348,18 +3364,6 @@ static ScopeBlock *find_block_scope(IrExecutable *exec, Scope *scope) { | ... | @@ -3348,18 +3364,6 @@ static ScopeBlock *find_block_scope(IrExecutable *exec, Scope *scope) { |
| 3348 | return nullptr; | 3364 | return nullptr; |
| 3349 | } | 3365 | } |
| 3350 | | 3366 | |
| 3351 | static IrInstruction *ir_build_check_statement_is_void(IrBuilder *irb, Scope *scope, AstNode *source_node, | | |
| 3352 | IrInstruction* statement_value) | | |
| 3353 | { | | |
| 3354 | IrInstructionCheckStatementIsVoid *instruction = ir_build_instruction<IrInstructionCheckStatementIsVoid>( | | |
| 3355 | irb, scope, source_node); | | |
| 3356 | instruction->statement_value = statement_value; | | |
| 3357 | | | |
| 3358 | ir_ref_instruction(statement_value, irb->current_basic_block); | | |
| 3359 | | | |
| 3360 | return &instruction->base; | | |
| 3361 | } | | |
| 3362 | | | |
| 3363 | static IrInstruction *ir_gen_block(IrBuilder *irb, Scope *parent_scope, AstNode *block_node) { | 3367 | static IrInstruction *ir_gen_block(IrBuilder *irb, Scope *parent_scope, AstNode *block_node) { |
| 3364 | assert(block_node->type == NodeTypeBlock); | 3368 | assert(block_node->type == NodeTypeBlock); |
| 3365 | | 3369 | |