language: Check For Incorrect Order For Action Parameters
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
This commit is contained in:
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user