Impl `pop`, which is the opposite of `dup`; and also the opposite of all the `push` instructions.

Confusingly, this one isn't documented in the AVM2 spec at all, but it's method of operation is fairly obvious.
This commit is contained in:
David Wendt 2020-03-05 21:11:04 -05:00
parent 9496fbde0a
commit 1cc8954747
1 changed files with 7 additions and 0 deletions

View File

@ -439,6 +439,7 @@ impl<'gc> Avm2<'gc> {
Op::PushTrue => self.op_push_true(),
Op::PushUint { value } => self.op_push_uint(value),
Op::PushUndefined => self.op_push_undefined(),
Op::Pop => self.op_pop(),
Op::Dup => self.op_dup(),
Op::GetLocal { index } => self.op_get_local(index),
Op::SetLocal { index } => self.op_set_local(context, index),
@ -580,6 +581,12 @@ impl<'gc> Avm2<'gc> {
Ok(())
}
fn op_pop(&mut self) -> Result<(), Error> {
self.pop();
Ok(())
}
fn op_dup(&mut self) -> Result<(), Error> {
self.push(self.stack.last().cloned().unwrap_or(Value::Undefined));