fix: thunk & function
This commit is contained in:
@@ -8,7 +8,7 @@ use super::Value;
|
||||
pub struct PrimOp<'vm> {
|
||||
pub name: &'static str,
|
||||
arity: u8,
|
||||
func: fn(&VM<'vm, '_>, Vec<Value<'vm>>) -> Value<'vm>,
|
||||
func: fn(&'vm VM<'_>, Vec<Value<'vm>>) -> Value<'vm>,
|
||||
}
|
||||
|
||||
impl PartialEq for PrimOp<'_> {
|
||||
@@ -18,7 +18,7 @@ impl PartialEq for PrimOp<'_> {
|
||||
}
|
||||
|
||||
impl<'vm> PrimOp<'vm> {
|
||||
pub fn call(self, vm: &VM<'vm, '_>, args: Vec<Value<'vm>>) -> Value<'vm> {
|
||||
pub fn call(self, vm: &'vm VM<'_>, args: Vec<Value<'vm>>) -> Value<'vm> {
|
||||
if (args.len() as u8) < self.arity {
|
||||
Value::PartialPrimOp(PartialPrimOp {
|
||||
name: self.name,
|
||||
@@ -39,7 +39,7 @@ pub struct PartialPrimOp<'vm> {
|
||||
pub name: &'static str,
|
||||
arity: u8,
|
||||
args: Vec<Value<'vm>>,
|
||||
func: fn(&VM<'vm, '_>, Vec<Value<'vm>>) -> Value<'vm>,
|
||||
func: fn(&'vm VM<'_>, Vec<Value<'vm>>) -> Value<'vm>,
|
||||
}
|
||||
|
||||
impl PartialEq for PartialPrimOp<'_> {
|
||||
@@ -49,7 +49,7 @@ impl PartialEq for PartialPrimOp<'_> {
|
||||
}
|
||||
|
||||
impl<'vm> PartialPrimOp<'vm> {
|
||||
pub fn call(mut self, vm: &VM<'vm, '_>, args: Vec<Value<'vm>>) -> Value<'vm> {
|
||||
pub fn call(mut self, vm: &'vm VM<'_>, args: Vec<Value<'vm>>) -> Value<'vm> {
|
||||
let len = args.len() as u8;
|
||||
self.args.extend(args);
|
||||
if len < self.arity {
|
||||
|
||||
Reference in New Issue
Block a user