From 94b73c41c6985e511806dbb43702ff85e8da4513 Mon Sep 17 00:00:00 2001 From: SoniEx2 Date: Mon, 31 Oct 2022 12:40:21 -0300 Subject: Finish step_out --- src/vm/mod.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/vm/mod.rs') diff --git a/src/vm/mod.rs b/src/vm/mod.rs index 131e48a..2e9d796 100644 --- a/src/vm/mod.rs +++ b/src/vm/mod.rs @@ -525,6 +525,22 @@ impl<'pat> Frame<'pat> { } } + /// Returns this value subtree, as an `(index, optional)` pair. + /// + /// # Panics + /// + /// Panics if iteration hasn't begun, or this isn't a value subtree. + fn value_subtree(&self) -> (usize, bool) { + if let PatternElement::ValueSubtree { + index, + optional, + } = self.raw_op() { + (index, optional) + } else { + unreachable!() + } + } + /// Returns the raw instruction. /// /// # Panics -- cgit 1.4.1