Add argcount checking to functions and ctors.

Before argument counts were only checked for overloaded functions/ctors.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13791 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Oliver Buchtala 2012-09-08 01:06:26 +00:00
commit 9b0c8dae83
2 changed files with 35 additions and 16 deletions

View file

@ -52,6 +52,8 @@ JSValueRef $jswrapper(JSContextRef context, JSObjectRef function, JSObjectRef th
{
$jslocals
JSValueRef jsresult;
if(argc != $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper.");
$jscode
return jsresult;
@ -68,6 +70,8 @@ int $jswrapper(JSContextRef context, JSObjectRef function, JSObjectRef thisObjec
{
$jslocals
JSValueRef jsresult;
if(argc != $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper.");
$jscode
*result = jsresult;
@ -231,6 +235,9 @@ ctor_dispatch_case: This template is used for the constructor which is overloade
JSObjectRef $jswrapper(JSContextRef context, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
{
$jslocals
if(argc != $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper.");
$jscode
return SWIG_JSC_NewPointerObj(context, result, SWIGTYPE_$jsmangledtype, SWIG_POINTER_OWN);
@ -240,6 +247,7 @@ JSObjectRef $jswrapper(JSContextRef context, JSObjectRef thisObject, size_t argc
return NULL;
}
%}
/**********************************************************************
initializer:This template is dynamic growing and aggregates everything
**********************************************************************/