Skip to content

Commit

Permalink
let Value be nothrow-move-constructible (#47422)
Browse files Browse the repository at this point in the history
Summary: Pull Request resolved: #47422

Reviewed By: Gownta

Differential Revision: D65273055

fbshipit-source-id: 6fda316137b1f797b8b4041521555e46e1098e7c
  • Loading branch information
yfeldblum authored and facebook-github-bot committed Nov 10, 2024
1 parent 44d6194 commit ae43411
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/react-native/ReactCommon/jsi/jsi/jsi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions packages/react-native/ReactCommon/jsi/jsi/jsi.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit ae43411

Please sign in to comment.