mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-08 12:19:37 +03:00
Shell: Allow non-exhaustive 'case' statements in POSIX
This commit is contained in:
parent
ef551a045d
commit
8a042cd9cb
Notes:
sideshowbarker
2024-07-17 06:51:40 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/8a042cd9cb Pull-request: https://github.com/SerenityOS/serenity/pull/18429 Reviewed-by: https://github.com/nico ✅
@ -2363,7 +2363,9 @@ ErrorOr<RefPtr<Value>> MatchExpr::run(RefPtr<Shell> shell)
|
||||
return move(result).get<RefPtr<Value>>();
|
||||
}
|
||||
|
||||
shell->raise_error(Shell::ShellError::EvaluatedSyntaxError, "Non-exhaustive match rules!", position());
|
||||
// Non-exhaustive 'case' statements are valid in POSIX.
|
||||
if (!shell || !shell->posix_mode())
|
||||
shell->raise_error(Shell::ShellError::EvaluatedSyntaxError, "Non-exhaustive match rules!", position());
|
||||
return make_ref_counted<AST::ListValue>({});
|
||||
}
|
||||
|
||||
|
@ -308,6 +308,8 @@ public:
|
||||
|
||||
void notify_child_event();
|
||||
|
||||
bool posix_mode() const { return m_in_posix_mode; }
|
||||
|
||||
struct termios termios;
|
||||
struct termios default_termios;
|
||||
bool was_interrupted { false };
|
||||
|
Loading…
Reference in New Issue
Block a user