Clean and detail End opcode.
This commit is contained in:
parent
921dda469e
commit
d5a383a442
|
@ -258,20 +258,25 @@ impl<'a> FunctionValidationContext<'a> {
|
||||||
};
|
};
|
||||||
|
|
||||||
if self.frame_stack.len() == 1 {
|
if self.frame_stack.len() == 1 {
|
||||||
// We are about to close the last frame. Insert
|
// We are about to close the last frame.
|
||||||
// an explicit return.
|
|
||||||
|
|
||||||
// Check the return type.
|
// Check the return type.
|
||||||
if let BlockType::Value(value_type) = self.return_type {
|
if let BlockType::Value(value_type) = self.return_type {
|
||||||
tee_value(&mut self.value_stack, &self.frame_stack, value_type.into())?;
|
tee_value(&mut self.value_stack, &self.frame_stack, value_type.into())?;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
pop_label(&mut self.value_stack, &mut self.frame_stack)?;
|
pop_label(&mut self.value_stack, &mut self.frame_stack)?;
|
||||||
|
|
||||||
// Push the result value.
|
// We just poped the last frame. To avoid some difficulties
|
||||||
if let BlockType::Value(value_type) = block_type {
|
// we prefer to keep this branch explicit and bail out here.
|
||||||
push_value(&mut self.value_stack, value_type.into())?;
|
()
|
||||||
|
} else {
|
||||||
|
pop_label(&mut self.value_stack, &mut self.frame_stack)?;
|
||||||
|
|
||||||
|
// Push the result value.
|
||||||
|
if let BlockType::Value(value_type) = block_type {
|
||||||
|
push_value(&mut self.value_stack, value_type.into())?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Br(depth) => {
|
Br(depth) => {
|
||||||
|
|
Loading…
Reference in New Issue