closures!!!
This commit is contained in:
parent
cdc54f54cb
commit
843c65ca16
|
|
@ -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(),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user