Minor refactor of D, C#, Java director code

for overloaded methods. Fixes regression (crash) in director_ignore D
testcase since string mangling names change.
This commit is contained in:
William S Fulton 2022-11-12 16:25:17 +00:00
commit 777fd2c280
3 changed files with 51 additions and 34 deletions

View file

@ -2988,7 +2988,7 @@ public:
* a Java long is used for all classes in the SWIG intermediary class.
* The intermediary class methods are thus mangled when overloaded to give
* a unique name. */
String *overloaded_name = NewStringf("%s", Getattr(n, "sym:name"));
String *overloaded_name = Copy(Getattr(n, "sym:name"));
if (Getattr(n, "sym:overloaded")) {
Printv(overloaded_name, Getattr(n, "sym:overname"), NIL);
@ -4003,7 +4003,7 @@ public:
String *name = Getattr(n, "name");
String *symname = Getattr(n, "sym:name");
SwigType *returntype = Getattr(n, "type");
String *overloaded_name = getOverloadedName(n);
String *overloaded_name = 0;
String *storage = Getattr(n, "storage");
String *value = Getattr(n, "value");
String *decl = Getattr(n, "decl");
@ -4026,7 +4026,7 @@ public:
String *classret_desc = NewString("");
SwigType *c_ret_type = NULL;
String *jupcall_args = NewString("swigjobj");
String *imclass_dmethod;
String *imclass_dmethod = 0;
String *callback_def = NewString("");
String *callback_code = NewString("");
String *imcall_args = NewString("");
@ -4039,7 +4039,11 @@ public:
// we're consistent with the sym:overload name in functionWrapper. (?? when
// does the overloaded method name get set?)
imclass_dmethod = NewStringf("%s", Swig_name_member(getNSpace(), dirclassname, overloaded_name));
if (!ignored_method) {
overloaded_name = getOverloadedName(n);
imclass_dmethod = Swig_name_member(getNSpace(), dirclassname, overloaded_name);
}
qualified_return = SwigType_rcaststr(returntype, "c_result");
@ -4092,12 +4096,14 @@ public:
}
}
/* Create the intermediate class wrapper */
tm = Swig_typemap_lookup("jtype", n, "", 0);
if (tm) {
Printf(callback_def, " public static %s %s(%s jself", tm, imclass_dmethod, qualified_classname);
} else {
Swig_warning(WARN_JAVA_TYPEMAP_JTYPE_UNDEF, input_file, line_number, "No jtype typemap defined for %s\n", SwigType_str(returntype, 0));
if (!ignored_method) {
/* Create the intermediate class wrapper */
tm = Swig_typemap_lookup("jtype", n, "", 0);
if (tm) {
Printf(callback_def, " public static %s %s(%s jself", tm, imclass_dmethod, qualified_classname);
} else {
Swig_warning(WARN_JAVA_TYPEMAP_JTYPE_UNDEF, input_file, line_number, "No jtype typemap defined for %s\n", SwigType_str(returntype, 0));
}
}
String *cdesc = NULL;