Simplify PopException

This commit is contained in:
Aviv Palivoda committed 2019-05-04 17:19:59 +03:00
1 parent 32714f889e
commit 810b8ee4d0
1 file changed
+7 -8
+7 -8
View File
@@ -862,14 +862,13 @@ impl Frame {
Ok(None)
}
bytecode::Instruction::PopException {} => {
assert!(vm.pop_exception().is_some());
let block = self.pop_block();
assert!(block.is_some());
match block.unwrap().typ {
BlockType::ExceptHandler => (),
_ => assert!(false),
};
Ok(None)
let block = self.pop_block().unwrap(); // this asserts that the block is_some.
if let BlockType::ExceptHandler = block.typ {
assert!(vm.pop_exception().is_some());
Ok(None)
} else {
panic!("Block type must be ExceptHandler here.")
}
}
}
}