fix for director_exception.i in ruby, ie, null ref in a 'Type' typemap is considered a TypeError

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8336 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2006-01-09 23:14:08 +00:00
commit 6b5d5ae8a0

View file

@ -28,7 +28,9 @@
%typemap(in,fragment=frag) Type {
Type *ptr = (Type *)0;
int res = asptr_meth($input, &ptr);
if (!SWIG_IsOK(res) || !ptr) { %argument_fail(res, "$type", $symname, $argnum); }
if (!SWIG_IsOK(res) || !ptr) {
%argument_fail((ptr ? res : SWIG_TypeError), "$type", $symname, $argnum);
}
$1 = *ptr;
if (SWIG_IsNewObj(res)) %delete(ptr);
}
@ -51,7 +53,9 @@
%typemap(varin,fragment=frag) Type {
Type *ptr = (Type *)0;
int res = asptr_meth($input, &ptr);
if (!SWIG_IsOK(res) || !ptr) { %variable_fail(res, "$type", "$name"); }
if (!SWIG_IsOK(res) || !ptr) {
%variable_fail((ptr ? res : SWIG_TypeError), "$type", "$name");
}
$1 = *ptr;
if (SWIG_IsNewObj(res)) %delete(ptr);
}
@ -65,7 +69,7 @@
Type *optr = 0;
int ores = $input ? asptr_meth($input, &optr) : 0;
if (!SWIG_IsOK(ores) || !optr) {
%dirout_fail(ores,"$type");
%dirout_fail((optr ? ores : SWIG_TypeError),"$type");
}
temp = *optr;
$result = &temp;
@ -76,7 +80,7 @@
Type *optr = 0;
int ores = asptr_meth($input, &optr);
if (!SWIG_IsOK(ores) || !optr) {
%dirout_fail(ores,"$type");
%dirout_fail((optr ? ores : SWIG_TypeError),"$type");
}
$result = *optr;
if (SWIG_IsNewObj(ores)) %delete(optr);