mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-10 15:14:44 +00:00
parse_execution: Use an exhaustive match instead of an assert
This could also be "cancel", which we didn't check and instead asserted out.
This commit is contained in:
parent
fb99edae92
commit
1503be4287
1 changed files with 23 additions and 17 deletions
|
@ -538,14 +538,16 @@ impl<'a> ParseExecutionContext {
|
|||
Some(&mut errors),
|
||||
false,
|
||||
);
|
||||
if expand_err == ExpandResultCode::error {
|
||||
match expand_err.result {
|
||||
ExpandResultCode::error => {
|
||||
// Issue #5812 - the expansions were done on the command token,
|
||||
// excluding prefixes such as " " or "if ".
|
||||
// This means that the error positions are relative to the beginning
|
||||
// of the token; we need to make them relative to the original source.
|
||||
parse_error_offset_source_start(&mut errors, pos_of_command_token);
|
||||
return self.report_errors(ctx, STATUS_ILLEGAL_CMD.unwrap(), &errors);
|
||||
} else if expand_err == ExpandResultCode::wildcard_no_match {
|
||||
}
|
||||
ExpandResultCode::wildcard_no_match => {
|
||||
return report_error!(
|
||||
self,
|
||||
ctx,
|
||||
|
@ -555,7 +557,11 @@ impl<'a> ParseExecutionContext {
|
|||
&self.node_source(statement)
|
||||
);
|
||||
}
|
||||
assert!(expand_err == ExpandResultCode::ok);
|
||||
ExpandResultCode::cancel => {
|
||||
return EndExecutionReason::cancelled;
|
||||
}
|
||||
ExpandResultCode::ok => {}
|
||||
}
|
||||
|
||||
// Complain if the resulting expansion was empty, or expanded to an empty string.
|
||||
// For no-exec it's okay, as we can't really perform the expansion.
|
||||
|
|
Loading…
Reference in a new issue