mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-05 09:06:08 +00:00
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.
This commit is contained in:
parent
2692db8699
commit
2b5054c903
Notes:
sideshowbarker
2024-07-17 07:43:05 +09:00
Author: https://github.com/trflynn89
Commit: 2b5054c903
Pull-request: https://github.com/SerenityOS/serenity/pull/17220
Reviewed-by: https://github.com/linusg ✅
1 changed files with 6 additions and 0 deletions
|
@ -332,6 +332,12 @@ public:
|
||||||
[[nodiscard]] ValueType release_value() { return m_value.release_value(); }
|
[[nodiscard]] ValueType release_value() { return m_value.release_value(); }
|
||||||
Completion release_error() { return m_throw_completion.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:
|
private:
|
||||||
Optional<Completion> m_throw_completion;
|
Optional<Completion> m_throw_completion;
|
||||||
Optional<ValueType> m_value;
|
Optional<ValueType> m_value;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue