Skip to content

Commit 1d73285

Browse files
committed
add Stack::peek_control
1 parent 6932bb8 commit 1d73285

File tree

1 file changed

+9
-0
lines changed
  • crates/wasmi/src/engine/translator/func2/stack

1 file changed

+9
-0
lines changed

crates/wasmi/src/engine/translator/func2/stack/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,15 @@ impl Stack {
319319
.unwrap_or_else(|| panic!("tried to pop control from empty control stack"))
320320
}
321321

322+
/// Returns a shared reference to the [`ControlFrame`] at `depth`.
323+
///
324+
/// # Panics
325+
///
326+
/// If `depth` is out of bounds for `self`.
327+
pub fn peek_control(&self, depth: usize) -> &ControlFrame {
328+
self.controls.get(depth)
329+
}
330+
322331
/// Pushes a local variable with index `local_idx` to the [`Stack`].
323332
///
324333
/// # Errors

0 commit comments

Comments
 (0)