Skip to content

Commit

Permalink
fix: DROP opcode
Browse files Browse the repository at this point in the history
Signed-off-by: nerodesu017 <[email protected]>
  • Loading branch information
nerodesu017 committed Nov 18, 2024
1 parent 512dba8 commit 1dee4d1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/validation/validation_stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ impl ValidationStack {
self.stack.push(ValidationStackEntry::Label(label_info));
}

/// Similar to [`ValidationStack::pop`], because it pops a value from the stack,
/// but more public and doesn't actually return the popped value.
pub(super) fn drop_val(&mut self) -> Result<()> {
match self.stack.pop().ok_or(Error::EndInvalidValueStack)? {
ValidationStackEntry::Val(_) => Ok(()),
_ => Err(Error::ExpectedAnOperand),
}
}

/// This puts an unspecified element on top of the stack.
/// While the top of the stack is unspecified, arbitrary value types can be popped.
/// To undo this, a new label has to be pushed or an existing one has to be popped.
Expand Down

0 comments on commit 1dee4d1

Please sign in to comment.