Formatting

This commit is contained in:
Michael Schimmel
2026-02-24 07:27:13 +01:00
parent 9b7ef5080c
commit eeb6621280
7 changed files with 713 additions and 334 deletions
+4 -15
View File
@@ -262,11 +262,7 @@ impl VM {
}
#[inline(always)]
fn eval_core<O: VMObserver>(
&mut self,
obs: &mut O,
node: &ExecNode,
) -> Result<Value, String> {
fn eval_core<O: VMObserver>(&mut self, obs: &mut O, node: &ExecNode) -> Result<Value, String> {
match &node.kind {
BoundKind::Nop => Ok(Value::Void),
BoundKind::Constant(v) => Ok(v.clone()),
@@ -380,14 +376,11 @@ impl VM {
if node.ty.is_tail {
match func_val {
Value::Object(obj) => {
return Ok(Value::TailCallRequest(Box::new((obj, arg_vals))))
return Ok(Value::TailCallRequest(Box::new((obj, arg_vals))));
}
Value::Function(f) => return Ok((f.func)(arg_vals)),
_ => {
return Err(format!(
"Tail call target is not a function: {}",
func_val
))
return Err(format!("Tail call target is not a function: {}", func_val));
}
}
}
@@ -423,10 +416,7 @@ impl VM {
res => break res,
}
} else {
break Err(format!(
"Object is not a closure: {}",
obj.type_name()
));
break Err(format!("Object is not a closure: {}", obj.type_name()));
}
}
_ => break Err(format!("Attempt to call non-function: {}", func_val)),
@@ -494,7 +484,6 @@ impl VM {
}
}
pub fn resolve_tail_calls(&mut self, mut result: Value) -> Value {
while let Value::TailCallRequest(payload) = result {
let (next_obj, next_args) = *payload;