summary refs log tree commit diff stats
path: root/src/vm/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/vm/mod.rs')
-rw-r--r--src/vm/mod.rs16
1 files changed, 16 insertions, 0 deletions
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