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:
Timothy Flynn 2023-01-28 12:45:22 -05:00 committed by Linus Groh
parent 2692db8699
commit 2b5054c903

View file

@ -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;