mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 09:52:27 -04:00
Fix issue where overloads with invalid default arg types weren't exported at all
This commit is contained in:
parent
f8779d7eaf
commit
426fdf0842
@ -4475,15 +4475,23 @@ write_function_instance(ostream &out, FunctionRemap *remap,
|
|||||||
|
|
||||||
// Now convert (the rest of the) actual arguments, one by one.
|
// Now convert (the rest of the) actual arguments, one by one.
|
||||||
for (; pn < num_params; ++pn) {
|
for (; pn < num_params; ++pn) {
|
||||||
if (pn > 0) {
|
ParameterRemap *param = remap->_parameters[pn]._remap;
|
||||||
expected_params += ", ";
|
CPPType *orig_type = param->get_orig_type();
|
||||||
|
CPPType *type = param->get_new_type();
|
||||||
|
CPPExpression *default_value = param->get_default_value();
|
||||||
|
string param_name = remap->get_parameter_name(pn);
|
||||||
|
|
||||||
|
if (!is_cpp_type_legal(orig_type)) {
|
||||||
|
// We can't wrap this. We sometimes get here for default arguments.
|
||||||
|
// Just skip this parameter.
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_optional = false;
|
|
||||||
// Has this remap been selected to consider optional arguments for
|
// Has this remap been selected to consider optional arguments for
|
||||||
// this parameter? We can do that by adding a vertical bar to the
|
// this parameter? We can do that by adding a vertical bar to the
|
||||||
// PyArg_ParseTuple format string, coupled with some extra logic
|
// PyArg_ParseTuple format string, coupled with some extra logic
|
||||||
// in the argument handling, below.
|
// in the argument handling, below.
|
||||||
|
bool is_optional = false;
|
||||||
if (remap->_has_this && !is_constructor) {
|
if (remap->_has_this && !is_constructor) {
|
||||||
if (pn > min_num_args) {
|
if (pn > min_num_args) {
|
||||||
is_optional = true;
|
is_optional = true;
|
||||||
@ -4500,11 +4508,9 @@ write_function_instance(ostream &out, FunctionRemap *remap,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ParameterRemap *param = remap->_parameters[pn]._remap;
|
if (pn > 0) {
|
||||||
CPPType *orig_type = param->get_orig_type();
|
expected_params += ", ";
|
||||||
CPPType *type = param->get_new_type();
|
}
|
||||||
CPPExpression *default_value = param->get_default_value();
|
|
||||||
string param_name = remap->get_parameter_name(pn);
|
|
||||||
|
|
||||||
// This is the string to convert our local variable to the
|
// This is the string to convert our local variable to the
|
||||||
// appropriate C++ type. Normally this is just a cast.
|
// appropriate C++ type. Normally this is just a cast.
|
||||||
@ -6432,10 +6438,11 @@ is_remap_legal(FunctionRemap *remap) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// all params must be legal
|
// all non-optional params must be legal
|
||||||
for (int pn = 0; pn < (int)remap->_parameters.size(); pn++) {
|
for (int pn = 0; pn < (int)remap->_parameters.size(); pn++) {
|
||||||
CPPType *orig_type = remap->_parameters[pn]._remap->get_orig_type();
|
ParameterRemap *param = remap->_parameters[pn]._remap;
|
||||||
if (!is_cpp_type_legal(orig_type)) {
|
CPPType *orig_type = param->get_orig_type();
|
||||||
|
if (param->get_default_value() == NULL && !is_cpp_type_legal(orig_type)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user