Merge pull request #2095 from vadz/extend-suffix
Use suffix for static methods added by %extend
This commit is contained in:
commit
3200a815d4
2 changed files with 26 additions and 12 deletions
|
|
@ -1320,11 +1320,15 @@ int Language::staticmemberfunctionHandler(Node *n) {
|
||||||
Delete(mrename);
|
Delete(mrename);
|
||||||
mrename = mangled;
|
mrename = mangled;
|
||||||
|
|
||||||
if (Getattr(n, "sym:overloaded") && code) {
|
if (code) {
|
||||||
|
// See Swig_MethodToFunction() for the explanation of this code.
|
||||||
|
if (Getattr(n, "sym:overloaded")) {
|
||||||
Append(cname, Getattr(defaultargs ? defaultargs : n, "sym:overname"));
|
Append(cname, Getattr(defaultargs ? defaultargs : n, "sym:overname"));
|
||||||
|
} else {
|
||||||
|
Append(cname, "__SWIG");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!defaultargs && code) {
|
if (!defaultargs) {
|
||||||
/* Hmmm. An added static member. We have to create a little wrapper for this */
|
/* Hmmm. An added static member. We have to create a little wrapper for this */
|
||||||
String *mangled_cname = Swig_name_mangle(cname);
|
String *mangled_cname = Swig_name_mangle(cname);
|
||||||
Swig_add_extension_code(n, mangled_cname, parms, type, code, CPlusPlus, 0);
|
Swig_add_extension_code(n, mangled_cname, parms, type, code, CPlusPlus, 0);
|
||||||
|
|
@ -1332,6 +1336,7 @@ int Language::staticmemberfunctionHandler(Node *n) {
|
||||||
Delete(mangled_cname);
|
Delete(mangled_cname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Setattr(n, "name", cname);
|
Setattr(n, "name", cname);
|
||||||
Setattr(n, "sym:name", mrename);
|
Setattr(n, "sym:name", mrename);
|
||||||
|
|
|
||||||
|
|
@ -1076,9 +1076,18 @@ int Swig_MethodToFunction(Node *n, const_String_or_char_ptr nspace, String *clas
|
||||||
|
|
||||||
/* Check if the method is overloaded. If so, and it has code attached, we append an extra suffix
|
/* Check if the method is overloaded. If so, and it has code attached, we append an extra suffix
|
||||||
to avoid a name-clash in the generated wrappers. This allows overloaded methods to be defined
|
to avoid a name-clash in the generated wrappers. This allows overloaded methods to be defined
|
||||||
in C. */
|
in C.
|
||||||
if (Getattr(n, "sym:overloaded") && code) {
|
|
||||||
|
But when not using the suffix used for overloaded functions, we still need to ensure that the
|
||||||
|
wrapper name doesn't conflict with any wrapper functions, so make it sufficiently unique by
|
||||||
|
appending a suffix similar to the one used for overloaded functions to it.
|
||||||
|
*/
|
||||||
|
if (code) {
|
||||||
|
if (Getattr(n, "sym:overloaded")) {
|
||||||
Append(mangled, Getattr(defaultargs ? defaultargs : n, "sym:overname"));
|
Append(mangled, Getattr(defaultargs ? defaultargs : n, "sym:overname"));
|
||||||
|
} else {
|
||||||
|
Append(mangled, "__SWIG");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See if there is any code that we need to emit */
|
/* See if there is any code that we need to emit */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue