aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorJosh Wolfe <thejoshwolfe@gmail.com>2017-04-23 08:34:18 -0700
committerJosh Wolfe <thejoshwolfe@gmail.com>2017-04-23 08:36:21 -0700
commit14dfbd6ad39dadbd8505957b031f67bcd1a7b8a4 (patch)
tree5aa31909123e29936445082720c9521b6a1c8443 /src/ir.cpp
parent8299fe19c056e9bae6f87a8281741d1e90019993 (diff)
downloadzig-14dfbd6ad39dadbd8505957b031f67bcd1a7b8a4.tar.gz
zig-14dfbd6ad39dadbd8505957b031f67bcd1a7b8a4.zip
remove redundant unreachable code error
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp11
1 files changed, 1 insertions, 10 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index 4055cbce8e..ece7aaf3cd 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -3387,15 +3387,6 @@ static IrInstruction *ir_gen_block(IrBuilder *irb, Scope *parent_scope, AstNode
continue;
}
- if (is_continuation_unreachable) {
- // if you put a semicolon after a return statement,
- // then we get a void statement in the unreachable area.
- // this is fine. ignore any void blocks we get from this happening.
- if (statement_node->type == NodeTypeBlock && statement_node->data.block.statements.length == 0)
- continue;
- add_node_error(irb->codegen, statement_node, buf_sprintf("unreachable code"));
- }
-
IrInstruction *statement_value = ir_gen_node(irb, statement_node, child_scope);
is_continuation_unreachable = instr_is_unreachable(statement_value);
if (is_continuation_unreachable)
@@ -3411,7 +3402,7 @@ static IrInstruction *ir_gen_block(IrBuilder *irb, Scope *parent_scope, AstNode
IrInstructionDeclVar *decl_var_instruction = (IrInstructionDeclVar *)statement_value;
child_scope = decl_var_instruction->var->child_scope;
} else {
- // label, defer, variable declaration will never be the last statement
+ // label, defer, variable declaration will never be the result expression
if (block_node->data.block.last_statement_is_result_expression &&
i == block_node->data.block.statements.length - 1) {
// this is the result value statement