Fix wrapping of overloaded protected methods when using allprotected mode
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10423 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
90179b787f
commit
b0ecf14e31
6 changed files with 51 additions and 4 deletions
|
|
@ -32,7 +32,11 @@ public:
|
|||
virtual ~PublicBase() { }
|
||||
virtual std::string virtualMethod() const { return "PublicBase"; }
|
||||
Klass instanceMethod(Klass k) const { return k; }
|
||||
Klass *instanceOverloaded(Klass *k) const { return k; }
|
||||
Klass *instanceOverloaded(Klass *k, std::string name) const { return new Klass(name); }
|
||||
static Klass staticMethod(Klass k) { return k; }
|
||||
static Klass *staticOverloaded(Klass *k) { return k; }
|
||||
static Klass *staticOverloaded(Klass *k, std::string name) { return new Klass(name); }
|
||||
int instanceMemberVariable;
|
||||
static int staticMemberVariable;
|
||||
static const int staticConstMemberVariable = 20;
|
||||
|
|
@ -50,7 +54,11 @@ protected:
|
|||
virtual ~ProtectedBase() { }
|
||||
virtual std::string virtualMethod() const { return "ProtectedBase"; }
|
||||
Klass instanceMethod(Klass k) const { return k; }
|
||||
Klass *instanceOverloaded(Klass *k) const { return k; }
|
||||
Klass *instanceOverloaded(Klass *k, std::string name) const { return new Klass(name); }
|
||||
static Klass staticMethod(Klass k) { return k; }
|
||||
static Klass *staticOverloaded(Klass *k) { return k; }
|
||||
static Klass *staticOverloaded(Klass *k, std::string name) { return new Klass(name); }
|
||||
int instanceMemberVariable;
|
||||
static int staticMemberVariable;
|
||||
static const int staticConstMemberVariable = 20;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,23 @@ class MyProtectedBase : ProtectedBase
|
|||
if (k.getName() != "xyz")
|
||||
throw new Exception("Failed");
|
||||
|
||||
k = staticMethod(new Klass("abc"));
|
||||
k = instanceOverloaded(new Klass("xyz"));
|
||||
if (k.getName() != "xyz")
|
||||
throw new Exception("Failed");
|
||||
|
||||
k = instanceOverloaded(new Klass("xyz"), "abc");
|
||||
if (k.getName() != "abc")
|
||||
throw new Exception("Failed");
|
||||
|
||||
k = ProtectedBase.staticMethod(new Klass("abc"));
|
||||
if (k.getName() != "abc")
|
||||
throw new Exception("Failed");
|
||||
|
||||
k = ProtectedBase.staticOverloaded(new Klass("xyz"));
|
||||
if (k.getName() != "xyz")
|
||||
throw new Exception("Failed");
|
||||
|
||||
k = ProtectedBase.staticOverloaded(new Klass("xyz"), "abc");
|
||||
if (k.getName() != "abc")
|
||||
throw new Exception("Failed");
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,23 @@ class MyProtectedBase extends ProtectedBase
|
|||
if (!k.getName().equals("xyz"))
|
||||
throw new RuntimeException("Failed");
|
||||
|
||||
k = staticMethod(new Klass("abc"));
|
||||
k = instanceOverloaded(new Klass("xyz"));
|
||||
if (!k.getName().equals("xyz"))
|
||||
throw new RuntimeException("Failed");
|
||||
|
||||
k = instanceOverloaded(new Klass("xyz"), "abc");
|
||||
if (!k.getName().equals("abc"))
|
||||
throw new RuntimeException("Failed");
|
||||
|
||||
k = ProtectedBase.staticMethod(new Klass("abc"));
|
||||
if (!k.getName().equals("abc"))
|
||||
throw new RuntimeException("Failed");
|
||||
|
||||
k = ProtectedBase.staticOverloaded(new Klass("xyz"));
|
||||
if (!k.getName().equals("xyz"))
|
||||
throw new RuntimeException("Failed");
|
||||
|
||||
k = ProtectedBase.staticOverloaded(new Klass("xyz"), "abc");
|
||||
if (!k.getName().equals("abc"))
|
||||
throw new RuntimeException("Failed");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue