This commit is contained in:
mb 2022-08-29 16:52:55 +03:00
commit 5c1cff92c6
15 changed files with 844 additions and 0 deletions

View file

@ -0,0 +1,28 @@
use crate::Value;
// TODO: refactor into {res} | {sc {} | {}}
pub enum EvRes {
Value(Value),
ReturnSC(Value),
BreakSC(Value),
}
impl EvRes {
pub fn new_val(value: Value) -> Self {
Self::Value(value)
}
pub fn is_short_circuit(&self) -> bool {
match self {
EvRes::Value(_) => false,
_ => true,
}
}
pub fn into_value(self) -> Option<Value> {
match self {
Self::Value(val) => Some(val),
_ => None,
}
}
}