Fix bug with mangling enums in overloaded function names

Don't generate "enum foo" in the function names, which obviously can't
contain spaces.

This allows another unit test to pass.
This commit is contained in:
Vadim Zeitlin 2019-08-04 17:09:00 +02:00
commit 11d7f09f7a
2 changed files with 12 additions and 9 deletions

View file

@ -597,17 +597,21 @@ public:
}
type = SwigType_base(type);
if (SwigType_isbuiltin(type))
if (SwigType_isbuiltin(type)) {
Printf(result, "%c", *Char(SwigType_base(type)));
else if (SwigType_isenum(type))
Printf(result, "e%s", Swig_scopename_last(type));
else
} else if (SwigType_isenum(type)) {
String* enumname = Swig_scopename_last(type);
const char* s = Char(enumname);
static const int len_enum_prefix = strlen("enum ");
if (strncmp(s, "enum ", len_enum_prefix) == 0)
s += len_enum_prefix;
Printf(result, "e%s", s);
} else {
Printf(result, "%s", Char(Swig_name_mangle(SwigType_base(type))));
}
if (prefix)
Delete(prefix);
if (type)
Delete(type);
Delete(prefix);
Delete(type);
return result;
}