Proper array typemaps in Javascript

https://github.com/swig/swig/issues/865
This commit is contained in:
Nickolay Shmyrev 2017-01-12 15:53:44 +01:00
commit cf7811b178
9 changed files with 115 additions and 125 deletions

View file

@ -56,7 +56,7 @@ typedef v8::PropertyCallbackInfo<v8::Value> SwigV8PropertyCallbackInfo;
#endif
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032318)
#define SWIGV8_ARRAY_NEW() v8::Array::New()
#define SWIGV8_ARRAY_NEW(size) v8::Array::New(size)
#define SWIGV8_BOOLEAN_NEW(bool) v8::Boolean::New(bool)
#define SWIGV8_EXTERNAL_NEW(val) v8::External::New(val)
#define SWIGV8_FUNCTEMPLATE_NEW(func) v8::FunctionTemplate::New(func)
@ -69,7 +69,7 @@ typedef v8::PropertyCallbackInfo<v8::Value> SwigV8PropertyCallbackInfo;
#define SWIGV8_UNDEFINED() v8::Undefined()
#define SWIGV8_NULL() v8::Null()
#else
#define SWIGV8_ARRAY_NEW() v8::Array::New(v8::Isolate::GetCurrent())
#define SWIGV8_ARRAY_NEW(size) v8::Array::New(v8::Isolate::GetCurrent(), size)
#define SWIGV8_BOOLEAN_NEW(bool) v8::Boolean::New(v8::Isolate::GetCurrent(), bool)
#define SWIGV8_EXTERNAL_NEW(val) v8::External::New(v8::Isolate::GetCurrent(), val)
#define SWIGV8_FUNCTEMPLATE_NEW(func) v8::FunctionTemplate::New(v8::Isolate::GetCurrent(), func)
@ -608,7 +608,7 @@ v8::Handle<v8::Value> SWIGV8_AppendOutput(v8::Local<v8::Value> result, v8::Handl
SWIGV8_HANDLESCOPE_ESC();
if (result->IsUndefined()) {
result = SWIGV8_ARRAY_NEW();
result = SWIGV8_ARRAY_NEW(0);
}
#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
v8::Handle<v8::Array> arr = v8::Handle<v8::Array>::Cast(result);