feat: a lot
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
use nixjit_macros::builtins;
|
||||
use nixjit_eval::EvalContext;
|
||||
|
||||
pub trait BuiltinsContext: EvalContext {}
|
||||
pub trait BuiltinsContext {}
|
||||
|
||||
#[builtins]
|
||||
mod builtins {
|
||||
pub mod builtins {
|
||||
use nixjit_error::{Error, Result};
|
||||
use nixjit_eval::Value;
|
||||
use nixjit_value::Const;
|
||||
@@ -15,7 +14,7 @@ mod builtins {
|
||||
const FALSE: Const = Const::Bool(false);
|
||||
const NULL: Const = Const::Null;
|
||||
|
||||
fn add<Ctx: BuiltinsContext>(a: Value<Ctx>, b: Value<Ctx>) -> Result<Value<Ctx>> {
|
||||
fn add(a: Value, b: Value) -> Result<Value> {
|
||||
use Value::*;
|
||||
Ok(match (a, b) {
|
||||
(Int(a), Int(b)) => Int(a + b),
|
||||
@@ -28,11 +27,11 @@ mod builtins {
|
||||
})
|
||||
}
|
||||
|
||||
pub fn import<Ctx: BuiltinsContext>(ctx: &mut Ctx, path: Value<Ctx>) -> Result<Value<Ctx>> {
|
||||
pub fn import<Ctx: BuiltinsContext>(ctx: &mut Ctx, path: Value) -> Result<Value> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn elem_at<Ctx: BuiltinsContext>(list: Value<Ctx>, idx: Value<Ctx>) -> Result<Value<Ctx>> {
|
||||
fn elem_at(list: Value, idx: Value) -> Result<Value> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user