IR: fix crash when duplicate label error

master
Andrew Kelley 2016-11-26 23:24:43 -05:00
parent a52ede6494
commit b3ff28189c
1 changed files with 5 additions and 4 deletions

View File

@ -2640,15 +2640,16 @@ IrInstruction *ir_gen(CodeGen *codegen, AstNode *node, BlockContext *scope, IrEx
IrInstruction *result = ir_gen_node_extra(irb, node, scope, LValPurposeNone);
assert(result);
if (irb->exec->invalid)
return codegen->invalid_instruction;
IrInstruction *return_instruction = ir_build_return(irb, result->source_node, result);
assert(return_instruction);
if (result == codegen->invalid_instruction)
return codegen->invalid_instruction;
if (!ir_goto_pass2(irb))
if (!ir_goto_pass2(irb)) {
irb->exec->invalid = true;
return codegen->invalid_instruction;
}
return return_instruction;
}