[PHP5]
Fix handling of a particular case involving overloaded functions with default parameters. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9849 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
beb9ab1031
commit
e72b6e8ff0
2 changed files with 11 additions and 28 deletions
|
|
@ -1,6 +1,11 @@
|
|||
Version 1.3.32 (in progress)
|
||||
============================
|
||||
|
||||
06/06/2007: olly
|
||||
[PHP5]
|
||||
Fix handling of a particular case involving overloaded functions
|
||||
with default parameters.
|
||||
|
||||
06/05/2007: mutandiz (Mikel Bancroft)
|
||||
[allegrocl]
|
||||
Fix case where we'd pass fully qualified identifiers
|
||||
|
|
|
|||
|
|
@ -1333,7 +1333,6 @@ public:
|
|||
bool handle_as_overload = false;
|
||||
String **arg_names;
|
||||
String **arg_values;
|
||||
bool *arg_case = NULL;
|
||||
// Method or static method or plain function.
|
||||
const char *methodname = 0;
|
||||
String *output = s_oowrappers;
|
||||
|
|
@ -1443,32 +1442,6 @@ public:
|
|||
l = nextSibling(l);
|
||||
}
|
||||
}
|
||||
|
||||
arg_case = (bool *) malloc(max_num_of_arguments * sizeof(bool));
|
||||
if (!arg_case) {
|
||||
/* FIXME: How should this be handled? The rest of SWIG just seems
|
||||
* to not bother checking for malloc failing! */
|
||||
fprintf(stderr, "Malloc failed!\n");
|
||||
exit(1);
|
||||
}
|
||||
for (int i = 0; i < max_num_of_arguments; ++i) {
|
||||
arg_case[i] = false;
|
||||
}
|
||||
|
||||
o = Getattr(n, "sym:overloaded");
|
||||
while (o) {
|
||||
ParmList *l2 = Getattr(o, "wrap:parms");
|
||||
int num_arguments = emit_num_arguments(l2);
|
||||
int num_required = emit_num_required(l2);
|
||||
if (wrapperType == memberfn) {
|
||||
--num_arguments;
|
||||
--num_required;
|
||||
}
|
||||
for (int i = num_required; i <= num_arguments; ++i) {
|
||||
arg_case[i] = true;
|
||||
}
|
||||
o = Getattr(o, "sym:nextSibling");
|
||||
}
|
||||
}
|
||||
|
||||
if (wrapperType == memberfn) {
|
||||
|
|
@ -1753,7 +1726,12 @@ public:
|
|||
if (i)
|
||||
Printf(args, ",");
|
||||
const char *value = Char(arg_values[i]);
|
||||
bool non_php_default = (!value || strcmp(value, "?") == 0);
|
||||
// FIXME: (really_overloaded && handle_as_overload) is perhaps a
|
||||
// little conservative, but it doesn't hit any cases that it
|
||||
// shouldn't for Xapian at least (and we need it to handle
|
||||
// "Enquire::get_mset()" correctly).
|
||||
bool non_php_default = ((really_overloaded && handle_as_overload) ||
|
||||
!value || strcmp(value, "?") == 0);
|
||||
if (non_php_default)
|
||||
value = "null";
|
||||
Printf(args, "$%s=%s", arg_names[i], value);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue