From 0473031ba44766b974d5b35160518c85455dd41d Mon Sep 17 00:00:00 2001 From: Chris Fallin Date: Sat, 11 Dec 2021 22:44:48 -0800 Subject: [PATCH] WIP. --- src/frontend.rs | 3 ++- src/ir.rs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/frontend.rs b/src/frontend.rs index 0337391..17cb7b4 100644 --- a/src/frontend.rs +++ b/src/frontend.rs @@ -836,8 +836,9 @@ impl<'a, 'b> FunctionBodyBuilder<'a, 'b> { .map(|(_ty, value)| *value) .collect::>(); self.locals.start_block(*el); - self.locals.finish_block(); + self.cur_block = Some(*el); self.emit_branch(*out, &else_result_values[..]); + self.locals.finish_block(); assert_eq!(self.op_stack.len(), *start_depth); self.cur_block = Some(*out); self.locals.seal_block_preds(*out, &mut self.body); diff --git a/src/ir.rs b/src/ir.rs index 83d63e4..29a6346 100644 --- a/src/ir.rs +++ b/src/ir.rs @@ -414,7 +414,7 @@ impl Terminator { ) if i <= targets.len() => { f(&mut targets[i - 1]); } - _ => panic!("out of bounds"), + (i, this) => panic!("out of bounds: index {} term {:?}", i, this), } }