feat: WIP
This commit is contained in:
@@ -330,13 +330,7 @@ impl<Ctx: EvalContext> Evaluate<Ctx> for ir::Str {
|
||||
impl<Ctx: EvalContext> Evaluate<Ctx> for ir::Const {
|
||||
/// Evaluates a `Const` literal into its corresponding `Value` variant.
|
||||
fn eval(&self, _: &mut Ctx) -> Result<Value> {
|
||||
let result = match self.val {
|
||||
Const::Null => Value::Null,
|
||||
Const::Int(x) => Value::Int(x),
|
||||
Const::Float(x) => Value::Float(x),
|
||||
Const::Bool(x) => Value::Bool(x),
|
||||
};
|
||||
Ok(result)
|
||||
Ok(self.val.into())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -76,6 +76,17 @@ impl Debug for Value {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Const> for Value {
|
||||
fn from(value: nixjit_value::Const) -> Self {
|
||||
match value {
|
||||
Const::Null => Value::Null,
|
||||
Const::Int(x) => Value::Int(x),
|
||||
Const::Float(x) => Value::Float(x),
|
||||
Const::Bool(x) => Value::Bool(x),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Value {
|
||||
pub const INT: u64 = 0;
|
||||
pub const FLOAT: u64 = 1;
|
||||
|
||||
Reference in New Issue
Block a user