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: facebook/react-native#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 15e9b5c commit b07ef4f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion API/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 API/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 b07ef4f

Please sign in to comment.