Fix bug in print and println builtins
They were looking at the first item on the stack, rather than the last item on the stack, for their `to_repr` value. Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -49,7 +49,7 @@ pub(crate) fn println(vm: &mut Vm, state: FunctionState) -> FunctionResult {
|
|||||||
FunctionResult::Yield(0)
|
FunctionResult::Yield(0)
|
||||||
}
|
}
|
||||||
FunctionState::Resume(0) => {
|
FunctionState::Resume(0) => {
|
||||||
println!("{}", vm.frame_stack()[0].borrow());
|
println!("{}", vm.frame_stack().last().unwrap().borrow());
|
||||||
Nil::create().into()
|
Nil::create().into()
|
||||||
}
|
}
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
@@ -69,7 +69,7 @@ pub(crate) fn print(vm: &mut Vm, state: FunctionState) -> FunctionResult {
|
|||||||
FunctionResult::Yield(0)
|
FunctionResult::Yield(0)
|
||||||
}
|
}
|
||||||
FunctionState::Resume(0) => {
|
FunctionState::Resume(0) => {
|
||||||
print!("{}", vm.frame_stack()[0].borrow());
|
print!("{}", vm.frame_stack().last().unwrap().borrow());
|
||||||
Nil::create().into()
|
Nil::create().into()
|
||||||
}
|
}
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
|
|||||||
Reference in New Issue
Block a user