fn call fix
This commit is contained in:
parent
1ebe51c7b3
commit
ad8700371f
2 changed files with 4 additions and 1 deletions
|
@ -223,7 +223,7 @@ impl Parser {
|
||||||
self.force_token(T::RightBrack)?;
|
self.force_token(T::RightBrack)?;
|
||||||
expr
|
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())),
|
T::String(string) => E::Literal(V::String(string.to_string().into())),
|
||||||
_ => return Err(Error::UnexpectedToken(tok).into())
|
_ => return Err(Error::UnexpectedToken(tok).into())
|
||||||
})
|
})
|
||||||
|
|
|
@ -181,6 +181,8 @@ impl Vm {
|
||||||
pub fn run(&mut self, fun: Rc<Function>) -> Result<Value> {
|
pub fn run(&mut self, fun: Rc<Function>) -> Result<Value> {
|
||||||
let mut frame = self.init_frame(fun)?;
|
let mut frame = self.init_frame(fun)?;
|
||||||
self.interupt.store(0, Ordering::SeqCst);
|
self.interupt.store(0, Ordering::SeqCst);
|
||||||
|
self.stack = Stack::new();
|
||||||
|
self.locals = Stack::new();
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
use Instruction::*;
|
use Instruction::*;
|
||||||
|
@ -303,6 +305,7 @@ impl Vm {
|
||||||
};
|
};
|
||||||
let ret = self.pop();
|
let ret = self.pop();
|
||||||
self.stack.truncate(frame.bp);
|
self.stack.truncate(frame.bp);
|
||||||
|
self.locals.truncate(0);
|
||||||
self.push(ret);
|
self.push(ret);
|
||||||
frame = prev_frame;
|
frame = prev_frame;
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue