interpreter: Fix bug where a break instruction would instead signal a return from subroutine

This commit is contained in:
John 2024-02-26 15:33:47 -06:00
parent 1bfeeb1755
commit ae76df9c83

View File

@ -760,7 +760,7 @@ pub mod interpret {
impl Interpret for Break { impl Interpret for Break {
fn interpret(&self, env: &mut Environment) -> IResult<ConValue> { fn interpret(&self, env: &mut Environment) -> IResult<ConValue> {
let Self { body } = self; let Self { body } = self;
Err(Error::Return( Err(Error::Break(
body.as_ref() body.as_ref()
.map(|body| body.interpret(env)) .map(|body| body.interpret(env))
.unwrap_or(Ok(ConValue::Empty))?, .unwrap_or(Ok(ConValue::Empty))?,