Make Formatter Happy

Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
This commit is contained in:
Will Hawkins
2026-04-16 06:59:50 -04:00
parent 82c125e4d1
commit 23e0bf5de3
4 changed files with 72 additions and 28 deletions
+21 -10
View File
@@ -22,7 +22,7 @@ public func Call<T>(
body: (ProgramExecution) -> (Result<T>, ProgramExecution), withArguments args: ArgumentList,
withParameters params: ParameterList, inExecution execution: ProgramExecution
) -> (Result<T>, ProgramExecution) {
if case .Error(let e) = args.compatible(params) {
return (.Error(e), execution)
}
@@ -53,21 +53,32 @@ public func Call<T>(
for (parameter, argument) in zip(params.parameters, args.arguments) {
if let param_direction = parameter.type.direction(),
param_direction == Direction.InOut || param_direction == Direction.Out {
param_direction == Direction.InOut || param_direction == Direction.Out
{
// Let's make sure that it is an evaluatable l value!
guard let arg_lvalue = argument.argument as? EvaluatableLValueExpression else {
return (.Error(Error(withMessage: "(in)out parameter argument is not lvalue")), updated_execution.exit_scope())
return (
.Error(Error(withMessage: "(in)out parameter argument is not lvalue")),
updated_execution.exit_scope()
)
}
guard case .Ok(let arg_new_value) = updated_execution.scopes.lookup(identifier: parameter.name) else {
return (.Error(Error(withMessage: "Could not get (in)out parameter value from scope")), updated_execution.exit_scope())
guard
case .Ok(let arg_new_value) = updated_execution.scopes.lookup(identifier: parameter.name)
else {
return (
.Error(Error(withMessage: "Could not get (in)out parameter value from scope")),
updated_execution.exit_scope()
)
}
switch arg_lvalue.set(to: arg_new_value, inScopes: inout_scopes, duringExecution: updated_execution) {
case .Ok((let updated_scopes, _)): inout_scopes = updated_scopes
case .Error(let e): return (.Error(e), updated_execution.exit_scope())
switch arg_lvalue.set(
to: arg_new_value, inScopes: inout_scopes, duringExecution: updated_execution)
{
case .Ok((let updated_scopes, _)): inout_scopes = updated_scopes
case .Error(let e): return (.Error(e), updated_execution.exit_scope())
}
}
}
}
return (.Ok(call_result), updated_execution.replaceScopes(inout_scopes))
}
}