Refactored the overloaded method error into

a simple auxiliary function in a .swg file.
This makes the resulting .cxx files a little
bit less bloated.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9767 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Gonzalo Garramuno 2007-05-03 22:45:13 +00:00
commit 8e630bd57d
2 changed files with 23 additions and 7 deletions

View file

@ -2005,13 +2005,10 @@ public:
Append( protoTypes, ")\\n\"" );
} while ((sibl = Getattr(sibl, "sym:nextSibling")));
Append(f->code, "fail:\n{\n");
Printf(f->code, "const char* swigMsg = \"Wrong # of arguments\";\n");
Printf(f->code, "if ( argc <= %d ) msg = \"Wrong arguments\";\n", maxargs);
Printf(f->code, "rb_raise(rb_eArgError,"
"\"%%s for overloaded method '%s'.\\n"
" Possible C/C++ prototypes are:\\n\"%s, swigMsg);\n", methodName, protoTypes);
Append(f->code, "}\nreturn Qnil;\n");
Append(f->code, "fail:\n");
Printf(f->code, "Ruby_Format_OverloadedError( argc, %d, \"%s\", %s);\n",
maxargs, methodName, protoTypes);
Append(f->code, "\nreturn Qnil;\n");
Delete(methodName);
Delete(type);