1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:47:35 +00:00

Shell: Implement the return POSIX builtin

This is also available in the regular shell mode, as it's a generally
useful builtin to have.
This commit is contained in:
Ali Mohammad Pur 2023-10-16 21:21:22 +03:30 committed by Andrew Kaster
parent 2d1c5dbfcb
commit a8c7448ccb
4 changed files with 25 additions and 1 deletions

View file

@ -60,6 +60,7 @@
__ENUMERATE_SHELL_BUILTIN(noop, InAllModes) \
__ENUMERATE_SHELL_BUILTIN(break, OnlyInPOSIXMode) \
__ENUMERATE_SHELL_BUILTIN(continue, OnlyInPOSIXMode) \
__ENUMERATE_SHELL_BUILTIN(return, InAllModes) \
__ENUMERATE_SHELL_BUILTIN(read, OnlyInPOSIXMode) \
__ENUMERATE_SHELL_BUILTIN(run_with_env, OnlyInPOSIXMode) \
__ENUMERATE_SHELL_BUILTIN(argsparser_parse, InAllModes) \
@ -360,6 +361,7 @@ public:
None,
InternalControlFlowBreak,
InternalControlFlowContinue,
InternalControlFlowReturn,
InternalControlFlowInterrupted,
InternalControlFlowKilled,
EvaluatedSyntaxError,
@ -396,6 +398,7 @@ public:
switch (error) {
case ShellError::InternalControlFlowBreak:
case ShellError::InternalControlFlowContinue:
case ShellError::InternalControlFlowReturn:
case ShellError::InternalControlFlowInterrupted:
case ShellError::InternalControlFlowKilled:
return true;