From b07ef4fc10dd53ad542f811040c820064c5ceb57 Mon Sep 17 00:00:00 2001 From: Yedidya Feldblum Date: Sun, 10 Nov 2024 02:42:41 -0800 Subject: [PATCH] let Value be nothrow-move-constructible (#47422) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/47422 Reviewed By: Gownta Differential Revision: D65273055 fbshipit-source-id: 6fda316137b1f797b8b4041521555e46e1098e7c --- API/jsi/jsi/jsi.cpp | 2 +- API/jsi/jsi/jsi.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/API/jsi/jsi/jsi.cpp b/API/jsi/jsi/jsi.cpp index 13588e1d04b..e11ef30d77e 100644 --- a/API/jsi/jsi/jsi.cpp +++ b/API/jsi/jsi/jsi.cpp @@ -333,7 +333,7 @@ Function Object::asFunction(Runtime& runtime) && { return std::move(*this).getFunction(runtime); } -Value::Value(Value&& other) : Value(other.kind_) { +Value::Value(Value&& other) noexcept : Value(other.kind_) { if (kind_ == BooleanKind) { data_.boolean = other.data_.boolean; } else if (kind_ == NumberKind) { diff --git a/API/jsi/jsi/jsi.h b/API/jsi/jsi/jsi.h index a826923a640..be48bb82474 100644 --- a/API/jsi/jsi/jsi.h +++ b/API/jsi/jsi/jsi.h @@ -1121,7 +1121,7 @@ class JSI_EXPORT Function : public Object { class JSI_EXPORT Value { public: /// Default ctor creates an \c undefined JS value. - Value() : Value(UndefinedKind) {} + Value() noexcept : Value(UndefinedKind) {} /// Creates a \c null JS value. /* implicit */ Value(std::nullptr_t) : kind_(NullKind) {} @@ -1162,7 +1162,7 @@ class JSI_EXPORT Value { "Value cannot be constructed directly from const char*"); } - Value(Value&& value); + Value(Value&& other) noexcept; /// Copies a Symbol lvalue into a new JS value. Value(Runtime& runtime, const Symbol& sym) : Value(SymbolKind) { @@ -1217,7 +1217,7 @@ class JSI_EXPORT Value { /// https://262.ecma-international.org/11.0/#sec-strict-equality-comparison static bool strictEquals(Runtime& runtime, const Value& a, const Value& b); - Value& operator=(Value&& other) { + Value& operator=(Value&& other) noexcept { this->~Value(); new (this) Value(std::move(other)); return *this;