diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2021-02-27 13:00:07 +0000 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2021-02-27 22:17:59 +0000 |
commit | 7cb719ee6734cf235f7d9d43cc50ba910a9518eb (patch) | |
tree | 9e1f763d3b11e7e33cbcd03142f6d3b9398f9c9b /Lib/javascript | |
parent | 1d4ef62466b7cc67080610b1fd8a91ef9c8a5b92 (diff) | |
download | swig-7cb719ee6734cf235f7d9d43cc50ba910a9518eb.tar.gz |
-Wunused-result fixes for Node < 12
Fix 0533fc26c which adds in calls to Check(), which was added in Node 12.
Also fix e6315eedd which calls the new Set() and Check() method.
Diffstat (limited to 'Lib/javascript')
-rw-r--r-- | Lib/javascript/v8/javascriptcode.swg | 4 | ||||
-rw-r--r-- | Lib/javascript/v8/javascriptcomplex.swg | 4 | ||||
-rw-r--r-- | Lib/javascript/v8/javascripthelpers.swg | 4 | ||||
-rw-r--r-- | Lib/javascript/v8/javascriptrun.swg | 7 |
4 files changed, 12 insertions, 7 deletions
diff --git a/Lib/javascript/v8/javascriptcode.swg b/Lib/javascript/v8/javascriptcode.swg index 79bcaa0a6..8e49101de 100644 --- a/Lib/javascript/v8/javascriptcode.swg +++ b/Lib/javascript/v8/javascriptcode.swg @@ -445,7 +445,7 @@ fail: #if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903) $jsparent_obj->Set(SWIGV8_SYMBOL_NEW("$jsname"), $jsmangledname_obj); #else - $jsparent_obj->Set(SWIGV8_CURRENT_CONTEXT(), SWIGV8_SYMBOL_NEW("$jsname"), $jsmangledname_obj).Check(); + SWIGV8_MAYBE_CHECK($jsparent_obj->Set(SWIGV8_CURRENT_CONTEXT(), SWIGV8_SYMBOL_NEW("$jsname"), $jsmangledname_obj)); #endif %} @@ -470,7 +470,7 @@ fail: #if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903) $jsparent_obj->Set(SWIGV8_SYMBOL_NEW("$jsname"), $jsmangledname_obj); #else - $jsparent_obj->Set(SWIGV8_CURRENT_CONTEXT(), SWIGV8_SYMBOL_NEW("$jsname"), $jsmangledname_obj).Check(); + SWIGV8_MAYBE_CHECK($jsparent_obj->Set(SWIGV8_CURRENT_CONTEXT(), SWIGV8_SYMBOL_NEW("$jsname"), $jsmangledname_obj)); #endif %} diff --git a/Lib/javascript/v8/javascriptcomplex.swg b/Lib/javascript/v8/javascriptcomplex.swg index 52a554905..102f60ca0 100644 --- a/Lib/javascript/v8/javascriptcomplex.swg +++ b/Lib/javascript/v8/javascriptcomplex.swg @@ -19,8 +19,8 @@ SWIG_From_dec(Type)(%ifcplusplus(const Type&, Type) c) v8::Local<v8::Array> vals = SWIGV8_ARRAY_NEW(); - vals->Set(SWIGV8_CURRENT_CONTEXT(), 0, SWIG_From(double)(Real(c))).Check(); - vals->Set(SWIGV8_CURRENT_CONTEXT(), 1, SWIG_From(double)(Imag(c))).Check(); + SWIGV8_MAYBE_CHECK(vals->Set(SWIGV8_CURRENT_CONTEXT(), 0, SWIG_From(double)(Real(c)))); + SWIGV8_MAYBE_CHECK(vals->Set(SWIGV8_CURRENT_CONTEXT(), 1, SWIG_From(double)(Imag(c)))); SWIGV8_ESCAPE(vals); } } diff --git a/Lib/javascript/v8/javascripthelpers.swg b/Lib/javascript/v8/javascripthelpers.swg index 37a794f92..0209ab378 100644 --- a/Lib/javascript/v8/javascripthelpers.swg +++ b/Lib/javascript/v8/javascripthelpers.swg @@ -67,7 +67,7 @@ SWIGRUNTIME void SWIGV8_AddStaticFunction(SWIGV8_OBJECT obj, const char* symbol, #elif (SWIG_V8_VERSION < 0x0706) obj->Set(SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func)->GetFunction(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked()); #else - obj->Set(SWIGV8_CURRENT_CONTEXT(), SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func)->GetFunction(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked()).Check(); + SWIGV8_MAYBE_CHECK(obj->Set(SWIGV8_CURRENT_CONTEXT(), SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func)->GetFunction(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked())); #endif } @@ -79,7 +79,7 @@ SWIGRUNTIME void SWIGV8_AddStaticVariable(SWIGV8_OBJECT obj, const char* symbol, #if (V8_MAJOR_VERSION-0) < 5 obj->SetAccessor(SWIGV8_SYMBOL_NEW(symbol), getter, setter); #else - obj->SetAccessor(SWIGV8_CURRENT_CONTEXT(), SWIGV8_SYMBOL_NEW(symbol), getter, setter).Check(); + SWIGV8_MAYBE_CHECK(obj->SetAccessor(SWIGV8_CURRENT_CONTEXT(), SWIGV8_SYMBOL_NEW(symbol), getter, setter)); #endif } diff --git a/Lib/javascript/v8/javascriptrun.swg b/Lib/javascript/v8/javascriptrun.swg index 5c0a2ff78..21b0a2a6e 100644 --- a/Lib/javascript/v8/javascriptrun.swg +++ b/Lib/javascript/v8/javascriptrun.swg @@ -143,6 +143,11 @@ typedef v8::PropertyCallbackInfo<v8::Value> SwigV8PropertyCallbackInfo; #define SWIGV8_UTF8_LENGTH(handle) (handle)->Utf8Length(v8::Isolate::GetCurrent()) #endif +#if (SWIG_V8_VERSION < 0x0704) +#define SWIGV8_MAYBE_CHECK(maybe) maybe.FromJust() +#else +#define SWIGV8_MAYBE_CHECK(maybe) maybe.Check() +#endif /* --------------------------------------------------------------------------- * Error handling @@ -699,7 +704,7 @@ SWIGV8_VALUE SWIGV8_AppendOutput(SWIGV8_VALUE result, SWIGV8_VALUE obj) { #if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903) || (SWIG_V8_VERSION < 0x0706) arr->Set(arr->Length(), obj); #else - arr->Set(SWIGV8_CURRENT_CONTEXT(), arr->Length(), obj).Check(); + SWIGV8_MAYBE_CHECK(arr->Set(SWIGV8_CURRENT_CONTEXT(), arr->Length(), obj)); #endif SWIGV8_ESCAPE(arr); |