Fix getNamespacedName() and reuse it for enum
There doesn't seem to be any unit tests covering this, but the old code was wrong because it didn't replace periods used as namespace separators with underscores, which resulted in periods appearing in the output when nested namespace were used. Fix this and also reuse the now fixed getNamespacedName() in getEnumName() which contained its own buggy version of the same code.
This commit is contained in:
parent
10b73ad2c1
commit
bd02ba19d8
1 changed files with 6 additions and 9 deletions
|
|
@ -155,10 +155,12 @@ public:
|
|||
String *nspace = Getattr(n, "sym:nspace");
|
||||
|
||||
if (nspace) {
|
||||
// FIXME: using namespace as class name is a hack.
|
||||
proxyname = Swig_name_member(NULL, nspace, symname);
|
||||
String *nspace_mangled = Copy(nspace);
|
||||
Replaceall(nspace_mangled, ".", "_");
|
||||
proxyname = NewStringf("%s_%s", nspace_mangled, symname);
|
||||
Delete(nspace_mangled);
|
||||
} else {
|
||||
proxyname = Copy(symname);
|
||||
proxyname = Copy(symname);
|
||||
}
|
||||
Setattr(n, "proxyname", proxyname);
|
||||
|
||||
|
|
@ -207,12 +209,7 @@ public:
|
|||
Delete(proxyname);
|
||||
} else {
|
||||
// global enum or enum in a namespace
|
||||
String *nspace = Getattr(n, "sym:nspace");
|
||||
if (nspace) {
|
||||
enumname = NewStringf("%s_%s", nspace, symname);
|
||||
} else {
|
||||
enumname = Copy(symname);
|
||||
}
|
||||
enumname = getNamespacedName(n);
|
||||
}
|
||||
Setattr(n, "enumname", enumname);
|
||||
Delete(enumname);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue