Apply patch #3248280 which adds better error messages when the incorrect number or type of arguments are passed to overloaded methods.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12564 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2011-03-29 19:15:19 +00:00
commit 24d695a7a1
2 changed files with 15 additions and 1 deletions

View file

@ -5,6 +5,10 @@ See the RELEASENOTES file for a summary of changes in each release.
Version 2.0.3 (in progress)
===========================
2011-03-29: wsfulton
[Tcl] Apply patch #3248280 from Christian Delbaere which adds better error messages when
the incorrect number or type of arguments are passed to overloaded methods.
2011-03-29: wsfulton
[Tcl] Apply patch #3224663 from Christian Delbaere.
1. Fix when function returns a NULL value, a "NULL" command will be created in the Tcl interpreter

View file

@ -531,7 +531,17 @@ public:
Printf(df->code, "Tcl_Obj *CONST *argv = objv+1;\n");
Printf(df->code, "int argc = objc-1;\n");
Printv(df->code, dispatch, "\n", NIL);
Printf(df->code, "Tcl_SetResult(interp,(char *) \"No matching function for overloaded '%s'\", TCL_STATIC);\n", iname);
Node *sibl = n;
while (Getattr(sibl, "sym:previousSibling"))
sibl = Getattr(sibl, "sym:previousSibling"); // go all the way up
String *protoTypes = NewString("");
do {
Printf(protoTypes, "\n\" %s(%s)\\n\"", SwigType_str(Getattr(sibl, "name"), 0), ParmList_protostr(Getattr(sibl, "wrap:parms")));
} while ((sibl = Getattr(sibl, "sym:nextSibling")));
Printf(df->code, "Tcl_SetResult(interp,(char *) "
"\"Wrong number or type of arguments for overloaded function '%s'.\\n\""
"\n\" Possible C/C++ prototypes are:\\n\"%s, TCL_STATIC);\n", iname, protoTypes);
Delete(protoTypes);
Printf(df->code, "return TCL_ERROR;\n");
Printv(df->code, "}\n", NIL);
Wrapper_print(df, f_wrappers);