Get the offsets and types for operand stack values, from top of stack (most recently pushed) down.
(
&self,
shape: FrameStackShape,
)
| 583 | /// Get the offsets and types for operand stack values, from top |
| 584 | /// of stack (most recently pushed) down. |
| 585 | pub fn stack( |
| 586 | &self, |
| 587 | shape: FrameStackShape, |
| 588 | ) -> impl Iterator<Item = (FrameStateSlotOffset, FrameValType)> { |
| 589 | fn unpack_option_shape(shape: FrameStackShape) -> Option<FrameStackShape> { |
| 590 | if shape.0 == u32::MAX { |
| 591 | None |
| 592 | } else { |
| 593 | Some(shape) |
| 594 | } |
| 595 | } |
| 596 | |
| 597 | let mut shape = unpack_option_shape(shape); |
| 598 | core::iter::from_fn(move || { |
| 599 | shape.map(|s| { |
| 600 | let parent = FrameStackShape(self.stack_shape_parents[s.index()].get(LittleEndian)); |
| 601 | let parent = unpack_option_shape(parent); |
| 602 | let offset = |
| 603 | FrameStateSlotOffset(self.stack_shape_offsets[s.index()].get(LittleEndian)); |
| 604 | let ty = FrameValType::try_from(self.stack_shape_types[s.index()]) |
| 605 | .expect("Invalid type"); |
| 606 | shape = parent; |
| 607 | (offset, ty) |
| 608 | }) |
| 609 | }) |
| 610 | } |
| 611 | |
| 612 | /// Returns an iterator over all storage in this frame. |
| 613 | pub fn stack_and_locals( |
no test coverage detected