closures!!!

This commit is contained in:
numzero 2025-04-19 14:57:52 +03:00
parent cdc54f54cb
commit 843c65ca16

View File

@ -324,7 +324,15 @@ impl Eval for Call {
impl Eval for Function { impl Eval for Function {
fn eval(&self, ctx: &RunContext) -> types::Value { fn eval(&self, ctx: &RunContext) -> types::Value {
todo!() let upvalues: Vec<_> = self
.upvalues
.iter()
.map(|(_name, id)| ctx.var(*id))
.collect();
let self_ = self.clone(); // TODO reference, somehow
Some(
types::Function::new(self.name.clone(), move |args| self_.call(&upvalues, args)).into(),
)
} }
} }