diff options
Diffstat (limited to 'src/vm.rs')
| -rw-r--r-- | src/vm.rs | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -325,10 +325,9 @@ impl VM { } fn pop_twice(&mut self) -> (Value, Value) { - let len = self.stack.len(); - let res = (self.stack[len-2].clone(), self.stack[len-1].clone()); - self.stack.truncate(len - 2); - res + let (a, b) = (self.stack.remove(self.stack.len() - 1), + self.stack.remove(self.stack.len() - 1)); + (b, a) // this matches the order they were on the stack } fn _peek_up(&self, amount: usize) -> Option<&Value> { |
