An improvement to error reporting and
more tests added to std::vector. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9723 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
8986650322
commit
7c4d3d8bd8
3 changed files with 13 additions and 7 deletions
|
|
@ -111,11 +111,11 @@ namespace swig {
|
|||
Type v;
|
||||
int res = asval(obj, &v);
|
||||
if (!obj || !SWIG_IsOK(res)) {
|
||||
if (throw_error) throw std::invalid_argument("bad type");
|
||||
VALUE lastErr = rb_gv_get("$!");
|
||||
if (lastErr == Qnil) {
|
||||
%type_error(swig::type_name<Type>());
|
||||
}
|
||||
if (throw_error) throw std::invalid_argument("bad type");
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
|
@ -136,12 +136,12 @@ namespace swig {
|
|||
}
|
||||
} else {
|
||||
// Uninitialized return value, no Type() constructor required.
|
||||
static Type *v_def = (Type*) malloc(sizeof(Type));
|
||||
if (throw_error) throw std::invalid_argument("bad type");
|
||||
VALUE lastErr = rb_gv_get("$!");
|
||||
if (lastErr == Qnil) {
|
||||
%type_error(swig::type_name<Type>());
|
||||
}
|
||||
if (throw_error) throw std::invalid_argument("bad type");
|
||||
static Type *v_def = (Type*) malloc(sizeof(Type));
|
||||
memset(v_def,0,sizeof(Type));
|
||||
return *v_def;
|
||||
}
|
||||
|
|
@ -156,11 +156,11 @@ namespace swig {
|
|||
if (SWIG_IsOK(res)) {
|
||||
return v;
|
||||
} else {
|
||||
if (throw_error) throw std::invalid_argument("bad type");
|
||||
VALUE lastErr = rb_gv_get("$!");
|
||||
if (lastErr == Qnil) {
|
||||
%type_error(swig::type_name<Type>());
|
||||
}
|
||||
if (throw_error) throw std::invalid_argument("bad type");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue