(&mut self, n: usize)
| 1759 | } |
| 1760 | |
| 1761 | fn pop_stack_n(&mut self, n: usize) -> Vec<Value<'gc>> { |
| 1762 | if n == 0 { |
| 1763 | return Vec::new(); |
| 1764 | } |
| 1765 | |
| 1766 | // Ensure we don't pop more items than are on the stack |
| 1767 | let n = n.min(self.stack_top); |
| 1768 | |
| 1769 | let new_top = self.stack_top - n; |
| 1770 | let mut result = Vec::with_capacity(n); |
| 1771 | |
| 1772 | // Copy values from the stack to the result vector |
| 1773 | result.extend_from_slice(&self.stack[new_top..self.stack_top]); |
| 1774 | |
| 1775 | // Update the stack top |
| 1776 | self.stack_top = new_top; |
| 1777 | |
| 1778 | // No need to reverse as we're copying from bottom to top |
| 1779 | result |
| 1780 | } |
| 1781 | |
| 1782 | #[cfg(feature = "debug")] |
| 1783 | pub fn print_stack(&self) { |
no outgoing calls
no test coverage detected