Refactor function signatures to use slices
This commit is contained in:
@@ -229,7 +229,7 @@ impl Environment {
|
||||
name: &str,
|
||||
ty: StaticType,
|
||||
purity_level: Purity,
|
||||
func: impl Fn(Vec<Value>) -> Value + 'static,
|
||||
func: impl Fn(&[Value]) -> Value + 'static,
|
||||
) {
|
||||
self.register_native(
|
||||
name,
|
||||
@@ -501,7 +501,7 @@ impl Environment {
|
||||
pub fn run_script_compiled(&self, compiled: TypedNode) -> Result<Value, String> {
|
||||
let linked = self.link(compiled);
|
||||
let func = self.instantiate(linked);
|
||||
let res = (func.func)(vec![]);
|
||||
let res = (func.func)(&[]);
|
||||
self.run_pipeline();
|
||||
Ok(res)
|
||||
}
|
||||
@@ -526,7 +526,7 @@ impl Environment {
|
||||
.downcast_ref::<crate::ast::vm::Closure>()
|
||||
.is_some()
|
||||
{
|
||||
result = vm.run_with_args_observed(&mut observer, next_obj, next_args);
|
||||
result = vm.run_with_args_observed(&mut observer, next_obj, &next_args);
|
||||
} else {
|
||||
result = Err(format!(
|
||||
"Tail call target is not a closure: {}",
|
||||
|
||||
Reference in New Issue
Block a user