Fixed problems when overloading C++ member functions.
- only register the wrapper function. - fix dispatchFunction() implementation to accomodate this_ptr. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@8661 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
e5e700b3c2
commit
466726083f
1 changed files with 15 additions and 2 deletions
|
|
@ -840,6 +840,8 @@ public:
|
|||
int maxargs;
|
||||
String *tmp = NewString("");
|
||||
String *dispatch = Swig_overload_dispatch(n,"return %s(INTERNAL_FUNCTION_PARAM_PASSTHRU);",&maxargs);
|
||||
|
||||
int has_this_ptr = (wrapperType==memberfn)?shadow:0;
|
||||
|
||||
/* Generate a dispatch wrapper for all overloaded functions */
|
||||
|
||||
|
|
@ -858,7 +860,15 @@ public:
|
|||
Wrapper_add_local(f,"ii","int ii");
|
||||
|
||||
Printf(f->code,"argc = ZEND_NUM_ARGS();\n");
|
||||
Printf(f->code,"zend_get_parameters_array_ex(argc,argv);\n");
|
||||
|
||||
if ( has_this_ptr ) {
|
||||
Printf(f->code,"argv[0] = &this_ptr;\n");
|
||||
Printf(f->code,"zend_get_parameters_array_ex(argc,argv+1);\n");
|
||||
Printf(f->code,"argc++;\n");
|
||||
}
|
||||
else {
|
||||
Printf(f->code,"zend_get_parameters_array_ex(argc,argv);\n");
|
||||
}
|
||||
|
||||
Replaceall(dispatch,"$args","self,args");
|
||||
|
||||
|
|
@ -1685,7 +1695,10 @@ public:
|
|||
this->Language::memberfunctionHandler(n);
|
||||
wrapperType = standard;
|
||||
|
||||
if(shadow) {
|
||||
// Only declare the member function if
|
||||
// we are doing shadow classes, and the function
|
||||
// is not overloaded, or if it is overloaded, it is the dispatch function.
|
||||
if(shadow && (!Getattr(n,"sym:overloaded") || !Getattr(n,"sym:nextSibling"))) {
|
||||
char *realname = iname ? iname : name;
|
||||
String *php_function_name = Swig_name_member(shadow_classname, realname);
|
||||
create_command(realname,Swig_name_wrapper(php_function_name));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue