language: Check For Incorrect Order For Action Parameters

Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
This commit is contained in:
Will Hawkins
2026-05-22 02:34:51 -04:00
parent a1908cc077
commit 24b0f0284a
2 changed files with 90 additions and 2 deletions
+11
View File
@@ -614,6 +614,17 @@ extension Action: Compilable {
}
current_context = updated_context
// Check whether the parameters are in the proper order.
let remaining_parameters = action_parameters.parameters.drop(while: {
$0.type.direction() != .none
})
if remaining_parameters.contains(where: { $0.type.direction() != .none }) {
return .Error(
ErrorWithLocation(
sourceLocation: current_node!.toSourceLocation(),
withError: "All parameters with direction must precede directionless parameters"))
}
walker.next()
#MustOr(
result: current_node, thing: walker.getNext(),