Add Javascript (JSC) support for type conversion
Fix types_directive testcase to ensure the %types code is actually called and not just cast from one type to the other.
This commit is contained in:
parent
9739be60d0
commit
6aef217438
3 changed files with 17 additions and 17 deletions
|
|
@ -117,27 +117,25 @@ SWIGRUNTIME int SWIG_JSC_ConvertInstancePtr(JSContextRef context, JSObjectRef ob
|
|||
SwigPrivData *cdata;
|
||||
|
||||
cdata = (SwigPrivData *) JSObjectGetPrivate(objRef);
|
||||
if(cdata == NULL) {
|
||||
if (cdata == NULL) {
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
if(cdata->info != info) {
|
||||
bool type_valid = false;
|
||||
swig_cast_info *t = info->cast;
|
||||
while(t != NULL) {
|
||||
if(t->type == cdata->info) {
|
||||
type_valid = true;
|
||||
break;
|
||||
}
|
||||
t = t->next;
|
||||
}
|
||||
if(!type_valid) {
|
||||
return SWIG_TypeError;
|
||||
assert(ptr);
|
||||
*ptr = NULL;
|
||||
if (cdata->info == info) {
|
||||
*ptr = cdata->swigCObject;
|
||||
} else {
|
||||
swig_cast_info *tc = SWIG_TypeCheckStruct(cdata->info, info);
|
||||
if (tc) {
|
||||
int newmemory = 0;
|
||||
*ptr = SWIG_TypeCast(tc, cdata->swigCObject, &newmemory);
|
||||
assert(!newmemory); /* newmemory handling not yet implemented */
|
||||
} else {
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
*ptr = cdata->swigCObject;
|
||||
|
||||
if(flags & SWIG_POINTER_DISOWN) {
|
||||
if (flags & SWIG_POINTER_DISOWN) {
|
||||
cdata->swigCMemOwn = false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <assert.h>
|
||||
%}
|
||||
|
||||
%insert(runtime) "swigrun.swg"; /* SWIG API */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue