Make arithmetic errors evaluate to 42

This commit is contained in:
Alex Bethel 2021-06-12 10:48:44 -05:00
parent 083eb01282
commit ede6eccc71
2 changed files with 2 additions and 6 deletions

View file

@ -18,7 +18,6 @@ pub enum ErrorKind {
MeloVariable(String), MeloVariable(String),
TypeError(String), TypeError(String),
TopLevelBreak, TopLevelBreak,
ArithmeticError,
BfInterpretError(InterpretError), BfInterpretError(InterpretError),
MissingLhs, MissingLhs,
} }

View file

@ -19,7 +19,7 @@ use rand::random;
use crate::{ use crate::{
ast::{Expr, Iden, Stmt, StmtKind}, ast::{Expr, Iden, Stmt, StmtKind},
base_55, base_55, consts,
error::{Error, ErrorKind}, error::{Error, ErrorKind},
variables::{Functio, Value, Variable}, variables::{Functio, Value, Variable},
}; };
@ -134,10 +134,7 @@ impl ExecEnv {
Divide => lhs.checked_div(rhs), Divide => lhs.checked_div(rhs),
_ => unreachable!(), _ => unreachable!(),
} }
.ok_or(Error { .unwrap_or(consts::ANSWER);
kind: ErrorKind::ArithmeticError,
span: expr.span.clone(),
})?;
Int(res) Int(res)
} }