summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Jezabek <jezabek@poczta.onet.pl>2008-10-26 11:08:38 +0000
committerJan Jezabek <jezabek@poczta.onet.pl>2008-10-26 11:08:38 +0000
commitd19fc193d121ebf575f70bee0ac184a1a120feb1 (patch)
tree60d43058b54b83b5b7acc96c44298fe16ccf9e83
parenteec64d9eeeb7af5e9c545d309ffd151bf479891f (diff)
downloadswig-d19fc193d121ebf575f70bee0ac184a1a120feb1.tar.gz
Rename overloads_base to overloadsbase. Do not set overloadsbase if there is a method with the same signature in one of the base classes (in which case "overrides" or "hides" is set). The "overloadsbase" attribute makes no sense in this case.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-jezabek@10894 626c5289-ae23-0410-ae9c-e8d60b6d4f22
-rw-r--r--Source/Modules/allocate.cxx16
-rw-r--r--Source/Modules/com.cxx4
2 files changed, 14 insertions, 6 deletions
diff --git a/Source/Modules/allocate.cxx b/Source/Modules/allocate.cxx
index 74290f156..b1eb2cb36 100644
--- a/Source/Modules/allocate.cxx
+++ b/Source/Modules/allocate.cxx
@@ -206,7 +206,11 @@ class Allocate:public Dispatcher {
/* Checks if a function, n, is the same as any in the base class, ie if the method is polymorphic.
* Also checks for methods which will be hidden (ie a base has an identical non-virtual method).
- * Both methods must have public access for a match to occur. */
+ * Both methods must have public access for a match to occur.
+ * Finally, if the method is not polymorphic and does not hide a method in a base class,
+ * it checks if a function has the same name as a function in the base class. In this case
+ * the "overloadsbase" attribute is set. This is for languages that do not support overloading.
+ */
int function_is_defined_in_bases(Node *n, Node *bases) {
if (!bases)
@@ -388,15 +392,19 @@ class Allocate:public Dispatcher {
if (!is_non_public_base(inclass, b))
Setattr(n, "hides", base);
}
- if (both_have_public_access || both_have_protected_access)
+ if (both_have_public_access || both_have_protected_access) {
+ // If we find an exact math - e.g. the method overrides or hides another one
+ // then the overloadsbase attribute makes no sense.
+ Delattr(n, "overloadsbase");
return 1;
+ }
} else if (is_public(base) && is_public(n) && !is_non_public_base(inclass, b)) {
// The name is being overloaded - mark it
- Setattr(n, "overloads_base", base);
+ Setattr(n, "overloadsbase", base);
}
} else if (is_public(base) && is_public(n) && !is_non_public_base(inclass, b)) {
// The name is being overloaded - mark it
- Setattr(n, "overloads_base", base);
+ Setattr(n, "overloadsbase", base);
}
}
}
diff --git a/Source/Modules/com.cxx b/Source/Modules/com.cxx
index 4afcfb24d..88653cddb 100644
--- a/Source/Modules/com.cxx
+++ b/Source/Modules/com.cxx
@@ -1794,8 +1794,8 @@ public:
return;
// Check if the name has not already been used in a base class
- if (Getattr(n, "overloads_base")) {
- Node *over = Getattr(n, "overloads_base");
+ if (Getattr(n, "overloadsbase")) {
+ Node *over = Getattr(n, "overloadsbase");
SwigType *tc = Copy(Getattr(n, "decl"));
String *oname;
String *cname;