diff options
author | Timothy Flynn <trflynn89@pm.me> | 2023-01-28 12:45:22 -0500 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-01-29 00:02:45 +0000 |
commit | 2b5054c9037dae39d38f5832013eeecd2bcc8394 (patch) | |
tree | e28d024814a3081f7f0caaff719ec2ebb2854699 /Userland/Libraries | |
parent | 2692db869963ed10947b05f13eade5fcbd5951dc (diff) | |
download | serenity-2b5054c9037dae39d38f5832013eeecd2bcc8394.zip |
LibJS: Add a method to ThrowCompletionOr to drop allocation errors
This should solely be used to ignore completions from Heap::allocate in
currently-infallible contexts. It's mostly meant to let us both ignore
these errors and mark them with a FIXME in one go.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/Completion.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Completion.h b/Userland/Libraries/LibJS/Runtime/Completion.h index 96dbd62a3a..6c0e51c346 100644 --- a/Userland/Libraries/LibJS/Runtime/Completion.h +++ b/Userland/Libraries/LibJS/Runtime/Completion.h @@ -332,6 +332,12 @@ public: [[nodiscard]] ValueType release_value() { return m_value.release_value(); } Completion release_error() { return m_throw_completion.release_value(); } + ValueType release_allocated_value_but_fixme_should_propagate_errors() + { + VERIFY(!is_error()); + return release_value(); + } + private: Optional<Completion> m_throw_completion; Optional<ValueType> m_value; |