Refactor function signatures to use slices

This commit is contained in:
Michael Schimmel
2026-03-03 18:13:20 +01:00
parent 7c38dee243
commit 8c4db9a5ba
12 changed files with 262 additions and 209 deletions
+3 -3
View File
@@ -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: {}",