summaryrefslogtreecommitdiff
path: root/Lib/javascript/v8/javascriptcomplex.swg
diff options
context:
space:
mode:
authorSergio Garcia Murillo <sergio.garcia.murillo@gmail.com>2021-11-29 16:12:38 +0100
committerGitHub <noreply@github.com>2021-11-29 16:12:38 +0100
commit975a36d5a55d69fdd96693e5f8e3f9ac559f70a7 (patch)
treed3a027a098f0a093f7435770fea91e1a445deb36 /Lib/javascript/v8/javascriptcomplex.swg
parent56e7455af91911c06210cf551729df61a428e5a6 (diff)
parent0304bdb82baaf5da94b6273c93e2623f1522a2a0 (diff)
downloadswig-975a36d5a55d69fdd96693e5f8e3f9ac559f70a7.tar.gz
Merge branch 'fix-cast' into master
Diffstat (limited to 'Lib/javascript/v8/javascriptcomplex.swg')
-rw-r--r--Lib/javascript/v8/javascriptcomplex.swg18
1 files changed, 9 insertions, 9 deletions
diff --git a/Lib/javascript/v8/javascriptcomplex.swg b/Lib/javascript/v8/javascriptcomplex.swg
index b73d5e2dd..7b3c5547e 100644
--- a/Lib/javascript/v8/javascriptcomplex.swg
+++ b/Lib/javascript/v8/javascriptcomplex.swg
@@ -17,7 +17,7 @@ SWIG_From_dec(Type)(%ifcplusplus(const Type&, Type) c)
{
SWIGV8_HANDLESCOPE_ESC();
- v8::Local<v8::Array> vals = SWIGV8_ARRAY_NEW();
+ v8::Local<v8::Array> vals = SWIGV8_ARRAY_NEW(0);
SWIGV8_ARRAY_SET(vals, 0, SWIG_From(double)(Real(c)));
SWIGV8_ARRAY_SET(vals, 1, SWIG_From(double)(Imag(c)));
@@ -39,23 +39,23 @@ SWIG_AsVal_dec(Type) (SWIGV8_VALUE o, Type* val)
if (o->IsArray()) {
SWIGV8_ARRAY array = SWIGV8_ARRAY::Cast(o);
- if(array->Length() != 2) SWIG_Error(SWIG_TypeError, "Illegal argument for complex: must be array[2].");
+ if (array->Length() != 2) SWIG_Error(SWIG_TypeError, "Illegal argument for complex: must be array[2].");
double re, im;
int res;
res = SWIG_AsVal(double)(SWIGV8_ARRAY_GET(array, 0), &re);
- if(!SWIG_IsOK(res)) {
+ if (!SWIG_IsOK(res)) {
return SWIG_TypeError;
}
res = SWIG_AsVal(double)(SWIGV8_ARRAY_GET(array, 1), &im);
- if(!SWIG_IsOK(res)) {
+ if (!SWIG_IsOK(res)) {
return SWIG_TypeError;
}
if (val) *val = Constructor(re, im);
return SWIG_OK;
- } else if(o->IsNumber()){
+ } else if (o->IsNumber()) {
double d;
int res = SWIG_AddCast(SWIG_AsVal(double)(o, &d));
if (SWIG_IsOK(res)) {
@@ -81,17 +81,17 @@ SWIG_AsVal_dec(Type) (SWIGV8_VALUE o, Type* val)
if (o->IsArray()) {
SWIGV8_ARRAY array = SWIGV8_ARRAY::Cast(o);
- if(array->Length() != 2) SWIG_Error(SWIG_TypeError, "Illegal argument for complex: must be array[2].");
+ if (array->Length() != 2) SWIG_Error(SWIG_TypeError, "Illegal argument for complex: must be array[2].");
double re, im;
int res;
res = SWIG_AsVal(double)(SWIGV8_ARRAY_GET(array, 0), &re);
- if(!SWIG_IsOK(res)) {
+ if (!SWIG_IsOK(res)) {
return SWIG_TypeError;
}
res = SWIG_AsVal(double)(SWIGV8_ARRAY_GET(array, 1), &im);
- if(!SWIG_IsOK(res)) {
+ if (!SWIG_IsOK(res)) {
return SWIG_TypeError;
}
@@ -102,7 +102,7 @@ SWIG_AsVal_dec(Type) (SWIGV8_VALUE o, Type* val)
} else {
return SWIG_OverflowError;
}
- } else if(o->IsNumber()){
+ } else if (o->IsNumber()) {
float re;
int res = SWIG_AddCast(SWIG_AsVal(float)(o, &re));
if (SWIG_IsOK(res)) {