Checkpoint
This commit is contained in:
18
src/eval.rs
18
src/eval.rs
@@ -46,6 +46,8 @@ pub use value::Value;
|
||||
|
||||
use crate::backend::BackendError;
|
||||
|
||||
use self::primtype::UnknownPrimType;
|
||||
|
||||
/// All of the errors that can happen trying to evaluate an NGR program.
|
||||
///
|
||||
/// This is yet another standard [`thiserror::Error`] type, but with the
|
||||
@@ -71,9 +73,13 @@ pub enum EvalError {
|
||||
ExitCode(std::process::ExitStatus),
|
||||
#[error("Unexpected output at runtime: {0}")]
|
||||
RuntimeOutput(String),
|
||||
#[error("Cannot cast to function type: {0}")]
|
||||
CastToFunction(String),
|
||||
#[error(transparent)]
|
||||
UnknownPrimType(#[from] UnknownPrimType),
|
||||
}
|
||||
|
||||
impl PartialEq for EvalError {
|
||||
impl PartialEq<EvalError> for EvalError {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
match self {
|
||||
EvalError::Lookup(a) => match other {
|
||||
@@ -115,6 +121,16 @@ impl PartialEq for EvalError {
|
||||
EvalError::RuntimeOutput(b) => a == b,
|
||||
_ => false,
|
||||
},
|
||||
|
||||
EvalError::CastToFunction(a) => match other {
|
||||
EvalError::CastToFunction(b) => a == b,
|
||||
_ => false,
|
||||
},
|
||||
|
||||
EvalError::UnknownPrimType(a) => match other {
|
||||
EvalError::UnknownPrimType(b) => a == b,
|
||||
_ => false,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user