Interface feature fix for typedef types
This commit is contained in:
parent
2dec8c5514
commit
5117c77d4a
2 changed files with 25 additions and 8 deletions
|
|
@ -49,3 +49,18 @@ struct U : R {};
|
||||||
struct V : S {};
|
struct V : S {};
|
||||||
struct W : T {};
|
struct W : T {};
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
#if defined(SWIGJAVA) || defined(SWIGCSHARP)
|
||||||
|
%interface_impl(BaseOverloaded);
|
||||||
|
#endif
|
||||||
|
%inline %{
|
||||||
|
struct BaseOverloaded {
|
||||||
|
typedef P PTypedef;
|
||||||
|
virtual ~BaseOverloaded() {}
|
||||||
|
virtual void identical_overload(int i, const PTypedef &pp = PTypedef()) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DerivedOverloaded : public BaseOverloaded {
|
||||||
|
virtual void identical_overload(int i, const PTypedef &p = PTypedef()) {}
|
||||||
|
};
|
||||||
|
%}
|
||||||
|
|
|
||||||
|
|
@ -144,27 +144,29 @@ void Swig_interface_propagate_methods(Node *n) {
|
||||||
if (!is_interface && GetFlag(mi.item, "abstract"))
|
if (!is_interface && GetFlag(mi.item, "abstract"))
|
||||||
continue;
|
continue;
|
||||||
String *this_decl = Getattr(mi.item, "decl");
|
String *this_decl = Getattr(mi.item, "decl");
|
||||||
String *resolved_decl = SwigType_typedef_resolve_all(this_decl);
|
String *this_decl_resolved = SwigType_typedef_resolve_all(this_decl);
|
||||||
bool overloaded = false;
|
bool identically_overloaded_method = false; // true when a base class' method is implemented in n
|
||||||
if (SwigType_isfunction(resolved_decl)) {
|
if (SwigType_isfunction(this_decl_resolved)) {
|
||||||
String *name = Getattr(mi.item, "name");
|
String *name = Getattr(mi.item, "name");
|
||||||
for (Node *child = firstChild(n); child; child = nextSibling(child)) {
|
for (Node *child = firstChild(n); child; child = nextSibling(child)) {
|
||||||
if (Getattr(child, "interface:owner"))
|
if (Getattr(child, "interface:owner"))
|
||||||
break; // at the end of the list are newly appended methods
|
break; // at the end of the list are newly appended methods
|
||||||
if (checkAttribute(child, "name", name)) {
|
if (checkAttribute(child, "name", name)) {
|
||||||
String *decl = SwigType_typedef_resolve_all(Getattr(child, "decl"));
|
String *decl = SwigType_typedef_resolve_all(Getattr(child, "decl"));
|
||||||
overloaded = Strcmp(decl, this_decl) == 0;
|
identically_overloaded_method = Strcmp(decl, this_decl_resolved) == 0;
|
||||||
Delete(decl);
|
Delete(decl);
|
||||||
if (overloaded)
|
if (identically_overloaded_method)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Delete(resolved_decl);
|
Delete(this_decl_resolved);
|
||||||
if (!overloaded)
|
if (!identically_overloaded_method) {
|
||||||
|
// TODO: Fix if the method is overloaded with different arguments / has default args
|
||||||
appendChild(n, mi.item);
|
appendChild(n, mi.item);
|
||||||
else
|
} else {
|
||||||
Delete(mi.item);
|
Delete(mi.item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Delete(methods);
|
Delete(methods);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue