Skip to content

Commit

Permalink
remove newly added NAPI_NOEXCEPT
Browse files Browse the repository at this point in the history
  • Loading branch information
vmoroz committed May 6, 2024
1 parent 44273cd commit 2b52856
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 28 deletions.
28 changes: 12 additions & 16 deletions napi-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -2988,10 +2988,9 @@ inline Object Error::Value() const {
return Object(_env, refValue);
}

inline Error::Error(Error&& other) NAPI_NOEXCEPT
: ObjectReference(std::move(other)) {}
inline Error::Error(Error&& other) : ObjectReference(std::move(other)) {}

inline Error& Error::operator=(Error&& other) NAPI_NOEXCEPT {
inline Error& Error::operator=(Error&& other) {
static_cast<Reference<Object>*>(this)->operator=(std::move(other));
return *this;
}
Expand Down Expand Up @@ -3200,7 +3199,7 @@ inline Reference<T>::~Reference() {
}

template <typename T>
inline Reference<T>::Reference(Reference<T>&& other) NAPI_NOEXCEPT
inline Reference<T>::Reference(Reference<T>&& other)
: _env(other._env),
_ref(other._ref),
_suppressDestruct(other._suppressDestruct) {
Expand All @@ -3210,8 +3209,7 @@ inline Reference<T>::Reference(Reference<T>&& other) NAPI_NOEXCEPT
}

template <typename T>
inline Reference<T>& Reference<T>::operator=(Reference<T>&& other)
NAPI_NOEXCEPT {
inline Reference<T>& Reference<T>::operator=(Reference<T>&& other) {
Reset();
_env = other._env;
_ref = other._ref;
Expand Down Expand Up @@ -3361,11 +3359,10 @@ inline ObjectReference& ObjectReference::operator=(Reference<Object>&& other) {
return *this;
}

inline ObjectReference::ObjectReference(ObjectReference&& other) NAPI_NOEXCEPT
inline ObjectReference::ObjectReference(ObjectReference&& other)
: Reference<Object>(std::move(other)) {}

inline ObjectReference& ObjectReference::operator=(ObjectReference&& other)
NAPI_NOEXCEPT {
inline ObjectReference& ObjectReference::operator=(ObjectReference&& other) {
static_cast<Reference<Object>*>(this)->operator=(std::move(other));
return *this;
}
Expand Down Expand Up @@ -3529,19 +3526,19 @@ inline FunctionReference::FunctionReference(napi_env env, napi_ref ref)
: Reference<Function>(env, ref) {}

inline FunctionReference::FunctionReference(Reference<Function>&& other)
NAPI_NOEXCEPT : Reference<Function>(std::move(other)) {}
: Reference<Function>(std::move(other)) {}

inline FunctionReference& FunctionReference::operator=(
Reference<Function>&& other) NAPI_NOEXCEPT {
Reference<Function>&& other) {
static_cast<Reference<Function>*>(this)->operator=(std::move(other));
return *this;
}

inline FunctionReference::FunctionReference(FunctionReference&& other)
NAPI_NOEXCEPT : Reference<Function>(std::move(other)) {}
: Reference<Function>(std::move(other)) {}

inline FunctionReference& FunctionReference::operator=(
FunctionReference&& other) NAPI_NOEXCEPT {
FunctionReference&& other) {
static_cast<Reference<Function>*>(this)->operator=(std::move(other));
return *this;
}
Expand Down Expand Up @@ -5020,15 +5017,14 @@ inline AsyncContext::~AsyncContext() {
}
}

inline AsyncContext::AsyncContext(AsyncContext&& other) NAPI_NOEXCEPT {
inline AsyncContext::AsyncContext(AsyncContext&& other) {
_env = other._env;
other._env = nullptr;
_context = other._context;
other._context = nullptr;
}

inline AsyncContext& AsyncContext::operator=(AsyncContext&& other)
NAPI_NOEXCEPT {
inline AsyncContext& AsyncContext::operator=(AsyncContext&& other) {
_env = other._env;
other._env = nullptr;
_context = other._context;
Expand Down
24 changes: 12 additions & 12 deletions napi.h
Original file line number Diff line number Diff line change
Expand Up @@ -1554,8 +1554,8 @@ class Reference {
~Reference();

// A reference can be moved but cannot be copied.
Reference(Reference<T>&& other) NAPI_NOEXCEPT;
Reference<T>& operator=(Reference<T>&& other) NAPI_NOEXCEPT;
Reference(Reference<T>&& other);
Reference<T>& operator=(Reference<T>&& other);
NAPI_DISALLOW_ASSIGN(Reference<T>)

operator napi_ref() const;
Expand Down Expand Up @@ -1601,8 +1601,8 @@ class ObjectReference : public Reference<Object> {
// A reference can be moved but cannot be copied.
ObjectReference(Reference<Object>&& other);
ObjectReference& operator=(Reference<Object>&& other);
ObjectReference(ObjectReference&& other) NAPI_NOEXCEPT;
ObjectReference& operator=(ObjectReference&& other) NAPI_NOEXCEPT;
ObjectReference(ObjectReference&& other);
ObjectReference& operator=(ObjectReference&& other);
NAPI_DISALLOW_ASSIGN(ObjectReference)

MaybeOrValue<Napi::Value> Get(const char* utf8name) const;
Expand Down Expand Up @@ -1637,10 +1637,10 @@ class FunctionReference : public Reference<Function> {
FunctionReference(napi_env env, napi_ref ref);

// A reference can be moved but cannot be copied.
FunctionReference(Reference<Function>&& other) NAPI_NOEXCEPT;
FunctionReference& operator=(Reference<Function>&& other) NAPI_NOEXCEPT;
FunctionReference(FunctionReference&& other) NAPI_NOEXCEPT;
FunctionReference& operator=(FunctionReference&& other) NAPI_NOEXCEPT;
FunctionReference(Reference<Function>&& other);
FunctionReference& operator=(Reference<Function>&& other);
FunctionReference(FunctionReference&& other);
FunctionReference& operator=(FunctionReference&& other);
NAPI_DISALLOW_ASSIGN_COPY(FunctionReference)

MaybeOrValue<Napi::Value> operator()(
Expand Down Expand Up @@ -1801,8 +1801,8 @@ class Error : public ObjectReference
Error(napi_env env, napi_value value);

// An error can be moved or copied.
Error(Error&& other) NAPI_NOEXCEPT;
Error& operator=(Error&& other) NAPI_NOEXCEPT;
Error(Error&& other);
Error& operator=(Error&& other);
Error(const Error&);
Error& operator=(const Error&);

Expand Down Expand Up @@ -2507,8 +2507,8 @@ class AsyncContext {
const Object& resource);
virtual ~AsyncContext();

AsyncContext(AsyncContext&& other) NAPI_NOEXCEPT;
AsyncContext& operator=(AsyncContext&& other) NAPI_NOEXCEPT;
AsyncContext(AsyncContext&& other);
AsyncContext& operator=(AsyncContext&& other);
NAPI_DISALLOW_ASSIGN_COPY(AsyncContext)

operator napi_async_context() const;
Expand Down

0 comments on commit 2b52856

Please sign in to comment.