fn call fix

This commit is contained in:
Murphy 2024-02-23 16:38:26 -05:00
parent 1ebe51c7b3
commit ad8700371f
Signed by: freya
GPG key ID: 744AB800E383AE52
2 changed files with 4 additions and 1 deletions

View file

@ -223,7 +223,7 @@ impl Parser {
self.force_token(T::RightBrack)?;
expr
},
T::Ident(ident) => E::Ident(ident),
T::Ident(ident) => E::Literal(V::String(ident.to_string().into())),
T::String(string) => E::Literal(V::String(string.to_string().into())),
_ => return Err(Error::UnexpectedToken(tok).into())
})

View file

@ -181,6 +181,8 @@ impl Vm {
pub fn run(&mut self, fun: Rc<Function>) -> Result<Value> {
let mut frame = self.init_frame(fun)?;
self.interupt.store(0, Ordering::SeqCst);
self.stack = Stack::new();
self.locals = Stack::new();
loop {
use Instruction::*;
@ -303,6 +305,7 @@ impl Vm {
};
let ret = self.pop();
self.stack.truncate(frame.bp);
self.locals.truncate(0);
self.push(ret);
frame = prev_frame;
},