feat: simple functions

This commit is contained in:
2025-05-04 14:42:22 +08:00
parent 6ecd20854a
commit bc50464db9
6 changed files with 77 additions and 27 deletions

View File

@@ -109,7 +109,7 @@ impl Value {
}
}
pub fn call(self, args: Vec<Value>) -> Value {
pub fn call(self, vm: &VM, args: Vec<Value>) -> Value {
use Value::*;
match self {
PrimOp(func) => func.call(args),
@@ -120,7 +120,7 @@ impl Value {
func = match func {
PrimOp(func) => return func.call([arg].into_iter().chain(iter).collect()),
PartialPrimOp(func) => return func.call([arg].into_iter().chain(iter).collect()),
Func(func) => func.call(arg),
Func(func) => func.call(vm, arg),
_ => todo!()
}
}