Skip to content

Commit 734725e

Browse files
rolftimmermansGabriel Schulhof
authored andcommitted
Correctly define copy assignment operators.
1 parent f677794 commit 734725e

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

napi-inl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2120,7 +2120,7 @@ inline Error& Error::operator =(Error&& other) {
21202120
inline Error::Error(const Error& other) : ObjectReference(other) {
21212121
}
21222122

2123-
inline Error& Error::operator =(Error& other) {
2123+
inline Error& Error::operator =(const Error& other) {
21242124
Reset();
21252125

21262126
_env = other.Env();

napi.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,7 +1108,7 @@ namespace Napi {
11081108
// A reference can be moved but cannot be copied.
11091109
Reference(Reference<T>&& other);
11101110
Reference<T>& operator =(Reference<T>&& other);
1111-
Reference<T>& operator =(Reference<T>&) = delete;
1111+
Reference<T>& operator =(const Reference<T>&) = delete;
11121112

11131113
operator napi_ref() const;
11141114
bool operator ==(const Reference<T> &other) const;
@@ -1153,7 +1153,7 @@ namespace Napi {
11531153
ObjectReference& operator =(Reference<Object>&& other);
11541154
ObjectReference(ObjectReference&& other);
11551155
ObjectReference& operator =(ObjectReference&& other);
1156-
ObjectReference& operator =(ObjectReference&) = delete;
1156+
ObjectReference& operator =(const ObjectReference&) = delete;
11571157

11581158
Napi::Value Get(const char* utf8name) const;
11591159
Napi::Value Get(const std::string& utf8name) const;
@@ -1191,7 +1191,7 @@ namespace Napi {
11911191
FunctionReference(FunctionReference&& other);
11921192
FunctionReference& operator =(FunctionReference&& other);
11931193
FunctionReference(const FunctionReference&) = delete;
1194-
FunctionReference& operator =(FunctionReference&) = delete;
1194+
FunctionReference& operator =(const FunctionReference&) = delete;
11951195

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

@@ -1333,7 +1333,7 @@ namespace Napi {
13331333
Error(Error&& other);
13341334
Error& operator =(Error&& other);
13351335
Error(const Error&);
1336-
Error& operator =(Error&);
1336+
Error& operator =(const Error&);
13371337

13381338
const std::string& Message() const NAPI_NOEXCEPT;
13391339
void ThrowAsJavaScriptException() const;
@@ -1806,7 +1806,7 @@ namespace Napi {
18061806
AsyncContext(AsyncContext&& other);
18071807
AsyncContext& operator =(AsyncContext&& other);
18081808
AsyncContext(const AsyncContext&) = delete;
1809-
AsyncContext& operator =(AsyncContext&) = delete;
1809+
AsyncContext& operator =(const AsyncContext&) = delete;
18101810

18111811
operator napi_async_context() const;
18121812

@@ -1825,7 +1825,7 @@ namespace Napi {
18251825
AsyncWorker(AsyncWorker&& other);
18261826
AsyncWorker& operator =(AsyncWorker&& other);
18271827
AsyncWorker(const AsyncWorker&) = delete;
1828-
AsyncWorker& operator =(AsyncWorker&) = delete;
1828+
AsyncWorker& operator =(const AsyncWorker&) = delete;
18291829

18301830
operator napi_async_work() const;
18311831

0 commit comments

Comments
 (0)