summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS
diff options
context:
space:
mode:
authorHendiadyoin1 <leon.a@serenityos.org>2022-03-30 21:37:26 +0200
committerTim Flynn <trflynn89@pm.me>2022-03-31 09:25:17 -0400
commitc79e4961f6b30ba28d7db4cf189bc1ae1fb12c3d (patch)
tree00410e15c0d42e792ec3ade1e4eda32b708ef80e /Userland/Libraries/LibJS
parent09a12247fb01eeb753a265ca862d4e3617f87e82 (diff)
downloadserenity-c79e4961f6b30ba28d7db4cf189bc1ae1fb12c3d.zip
LibJS: Add explicit default copy+move constructors to ThrowCompletionOr
This stops clangd from complaining about not being able to determine the copy-constructibility of ThrowCompletionOr and Completion.
Diffstat (limited to 'Userland/Libraries/LibJS')
-rw-r--r--Userland/Libraries/LibJS/Runtime/Completion.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Completion.h b/Userland/Libraries/LibJS/Runtime/Completion.h
index 5e857f1edb..52322e9b4c 100644
--- a/Userland/Libraries/LibJS/Runtime/Completion.h
+++ b/Userland/Libraries/LibJS/Runtime/Completion.h
@@ -49,6 +49,11 @@ public:
{
}
+ Completion(Completion const&) = default;
+ Completion& operator=(Completion const&) = default;
+ Completion(Completion&&) = default;
+ Completion& operator=(Completion&&) = default;
+
[[nodiscard]] Type type() const { return m_type; }
[[nodiscard]] Optional<Value>& value() { return m_value; }
[[nodiscard]] Optional<Value> const& value() const { return m_value; }
@@ -112,6 +117,11 @@ public:
VERIFY(!m_value->is_empty());
}
+ ThrowCompletionOr(ThrowCompletionOr const&) = default;
+ ThrowCompletionOr& operator=(ThrowCompletionOr const&) = default;
+ ThrowCompletionOr(ThrowCompletionOr&&) = default;
+ ThrowCompletionOr& operator=(ThrowCompletionOr&&) = default;
+
// Allows implicit construction of ThrowCompletionOr<T> from a type U if T(U) is a supported constructor.
// Most commonly: Value from Object* or similar, so we can omit the curly braces from "return { TRY(...) };".
// Disabled for POD types to avoid weird conversion shenanigans.