Using declarations in inheritance hierarchy improvements.
- Improved documentation for using declarations. - Issue new warning WARN_LANG_USING_NAME_DIFFERENT when there is a conflict in the target language name to be used when introducing a method via a using declaration. Previously the method was silently ignored. Issue #1840. Issue #655.
This commit is contained in:
parent
e36e898c0a
commit
79a1bbee8b
8 changed files with 176 additions and 30 deletions
|
|
@ -213,6 +213,7 @@
|
|||
#define WARN_LANG_EXTEND_DESTRUCTOR 523
|
||||
#define WARN_LANG_EXPERIMENTAL 524
|
||||
#define WARN_LANG_DIRECTOR_FINAL 525
|
||||
#define WARN_LANG_USING_NAME_DIFFERENT 526
|
||||
|
||||
/* -- Doxygen comments -- */
|
||||
|
||||
|
|
|
|||
|
|
@ -1047,13 +1047,6 @@ class TypePass:private Dispatcher {
|
|||
|| (Getattr(c, "feature:extend") && !Getattr(c, "code"))
|
||||
|| GetFlag(c, "feature:ignore"))) {
|
||||
|
||||
/* Don't generate a method if the method is overridden in this class,
|
||||
* for example don't generate another m(bool) should there be a Base::m(bool) :
|
||||
* struct Derived : Base {
|
||||
* void m(bool);
|
||||
* using Base::m;
|
||||
* };
|
||||
*/
|
||||
String *csymname = Getattr(c, "sym:name");
|
||||
if (!csymname || (Strcmp(csymname, symname) == 0)) {
|
||||
{
|
||||
|
|
@ -1069,6 +1062,13 @@ class TypePass:private Dispatcher {
|
|||
over = Getattr(over, "sym:nextSibling");
|
||||
}
|
||||
if (match) {
|
||||
/* Don't generate a method if the method is overridden in this class,
|
||||
* for example don't generate another m(bool) should there be a Base::m(bool) :
|
||||
* struct Derived : Base {
|
||||
* void m(bool);
|
||||
* using Base::m;
|
||||
* };
|
||||
*/
|
||||
c = Getattr(c, "csym:nextSibling");
|
||||
continue;
|
||||
}
|
||||
|
|
@ -1117,6 +1117,9 @@ class TypePass:private Dispatcher {
|
|||
} else {
|
||||
Delete(nn);
|
||||
}
|
||||
} else {
|
||||
Swig_warning(WARN_LANG_USING_NAME_DIFFERENT, Getfile(n), Getline(n), "Using declaration %s, with name '%s', is not actually using\n", SwigType_namestr(Getattr(n, "uname")), symname);
|
||||
Swig_warning(WARN_LANG_USING_NAME_DIFFERENT, Getfile(c), Getline(c), "the method from %s, with name '%s', as the names are different.\n", Swig_name_decl(c), csymname);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue