| ... | @@ -3387,15 +3387,6 @@ static IrInstruction *ir_gen_block(IrBuilder *irb, Scope *parent_scope, AstNode | ... | @@ -3387,15 +3387,6 @@ static IrInstruction *ir_gen_block(IrBuilder *irb, Scope *parent_scope, AstNode |
| 3387 | continue; | 3387 | continue; |
| 3388 | } | 3388 | } |
| 3389 | | 3389 | |
| 3390 | if (is_continuation_unreachable) { | | |
| 3391 | // if you put a semicolon after a return statement, | | |
| 3392 | // then we get a void statement in the unreachable area. | | |
| 3393 | // this is fine. ignore any void blocks we get from this happening. | | |
| 3394 | if (statement_node->type == NodeTypeBlock && statement_node->data.block.statements.length == 0) | | |
| 3395 | continue; | | |
| 3396 | add_node_error(irb->codegen, statement_node, buf_sprintf("unreachable code")); | | |
| 3397 | } | | |
| 3398 | | | |
| 3399 | IrInstruction *statement_value = ir_gen_node(irb, statement_node, child_scope); | 3390 | IrInstruction *statement_value = ir_gen_node(irb, statement_node, child_scope); |
| 3400 | is_continuation_unreachable = instr_is_unreachable(statement_value); | 3391 | is_continuation_unreachable = instr_is_unreachable(statement_value); |
| 3401 | if (is_continuation_unreachable) | 3392 | if (is_continuation_unreachable) |
| ... | @@ -3411,7 +3402,7 @@ static IrInstruction *ir_gen_block(IrBuilder *irb, Scope *parent_scope, AstNode | ... | @@ -3411,7 +3402,7 @@ static IrInstruction *ir_gen_block(IrBuilder *irb, Scope *parent_scope, AstNode |
| 3411 | IrInstructionDeclVar *decl_var_instruction = (IrInstructionDeclVar *)statement_value; | 3402 | IrInstructionDeclVar *decl_var_instruction = (IrInstructionDeclVar *)statement_value; |
| 3412 | child_scope = decl_var_instruction->var->child_scope; | 3403 | child_scope = decl_var_instruction->var->child_scope; |
| 3413 | } else { | 3404 | } else { |
| 3414 | // label, defer, variable declaration will never be the last statement | 3405 | // label, defer, variable declaration will never be the result expression |
| 3415 | if (block_node->data.block.last_statement_is_result_expression && | 3406 | if (block_node->data.block.last_statement_is_result_expression && |
| 3416 | i == block_node->data.block.statements.length - 1) { | 3407 | i == block_node->data.block.statements.length - 1) { |
| 3417 | // this is the result value statement | 3408 | // this is the result value statement |