Skip to content

Commit

Permalink
Correctly define copy assignment operators.
Browse files Browse the repository at this point in the history
  • Loading branch information
rolftimmermans authored and Gabriel Schulhof committed Dec 3, 2019
1 parent f677794 commit 734725e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion napi-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -2120,7 +2120,7 @@ inline Error& Error::operator =(Error&& other) {
inline Error::Error(const Error& other) : ObjectReference(other) {
}

inline Error& Error::operator =(Error& other) {
inline Error& Error::operator =(const Error& other) {
Reset();

_env = other.Env();
Expand Down
12 changes: 6 additions & 6 deletions napi.h
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,7 @@ namespace Napi {
// A reference can be moved but cannot be copied.
Reference(Reference<T>&& other);
Reference<T>& operator =(Reference<T>&& other);
Reference<T>& operator =(Reference<T>&) = delete;
Reference<T>& operator =(const Reference<T>&) = delete;

operator napi_ref() const;
bool operator ==(const Reference<T> &other) const;
Expand Down Expand Up @@ -1153,7 +1153,7 @@ namespace Napi {
ObjectReference& operator =(Reference<Object>&& other);
ObjectReference(ObjectReference&& other);
ObjectReference& operator =(ObjectReference&& other);
ObjectReference& operator =(ObjectReference&) = delete;
ObjectReference& operator =(const ObjectReference&) = delete;

Napi::Value Get(const char* utf8name) const;
Napi::Value Get(const std::string& utf8name) const;
Expand Down Expand Up @@ -1191,7 +1191,7 @@ namespace Napi {
FunctionReference(FunctionReference&& other);
FunctionReference& operator =(FunctionReference&& other);
FunctionReference(const FunctionReference&) = delete;
FunctionReference& operator =(FunctionReference&) = delete;
FunctionReference& operator =(const FunctionReference&) = delete;

Napi::Value operator ()(const std::initializer_list<napi_value>& args) const;

Expand Down Expand Up @@ -1333,7 +1333,7 @@ namespace Napi {
Error(Error&& other);
Error& operator =(Error&& other);
Error(const Error&);
Error& operator =(Error&);
Error& operator =(const Error&);

const std::string& Message() const NAPI_NOEXCEPT;
void ThrowAsJavaScriptException() const;
Expand Down Expand Up @@ -1806,7 +1806,7 @@ namespace Napi {
AsyncContext(AsyncContext&& other);
AsyncContext& operator =(AsyncContext&& other);
AsyncContext(const AsyncContext&) = delete;
AsyncContext& operator =(AsyncContext&) = delete;
AsyncContext& operator =(const AsyncContext&) = delete;

operator napi_async_context() const;

Expand All @@ -1825,7 +1825,7 @@ namespace Napi {
AsyncWorker(AsyncWorker&& other);
AsyncWorker& operator =(AsyncWorker&& other);
AsyncWorker(const AsyncWorker&) = delete;
AsyncWorker& operator =(AsyncWorker&) = delete;
AsyncWorker& operator =(const AsyncWorker&) = delete;

operator napi_async_work() const;

Expand Down

0 comments on commit 734725e

Please sign in to comment.