init
This commit is contained in:
commit
5c1cff92c6
15 changed files with 844 additions and 0 deletions
28
lorgn_runtime/src/runtime/eval_result.rs
Normal file
28
lorgn_runtime/src/runtime/eval_result.rs
Normal 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,
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue