From 58bbaddc21ba2e11f27a2f5cd9d8f8d71fb32244 Mon Sep 17 00:00:00 2001 From: Jur van den Berg Date: Thu, 24 May 2018 14:39:01 +0200 Subject: [PATCH] Extend frame a bit --- src/frame.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/frame.rs b/src/frame.rs index e98c4c8..c7a69b1 100644 --- a/src/frame.rs +++ b/src/frame.rs @@ -4,7 +4,7 @@ use stack::Stack; #[derive(Debug)] pub struct Frame { pub stack: Stack, - locals: Vec, + pub locals: Vec, } impl Frame { @@ -18,6 +18,14 @@ impl Frame { } } + pub fn len(&self) -> usize { + self.locals.len() + } + + pub fn is_empty(&self) -> bool { + self.locals.is_empty() + } + pub fn get(&self, offset: usize) -> Result { if offset >= self.locals.len() { return Err("Local variable out of range");