fix %ignore *::Bar::foo case

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6910 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2004-12-21 21:21:58 +00:00
commit 9c9985bd6f
2 changed files with 37 additions and 15 deletions

View file

@ -2,20 +2,32 @@
%ignore Foo;
%ignore *::Bar::foo;
%inline %{
class Foo {
public:
virtual ~Foo() { }
virtual char *blah() = 0;
};
class Foo {
public:
virtual ~Foo() { }
virtual char *blah() = 0;
};
namespace hi
{
namespace hello
{
class Bar : public Foo {
public:
void foo(void) {};
virtual char *blah() { return (char *) "Bar::blah"; }
};
}
}
class Bar : public Foo {
public:
virtual char *blah() { return (char *) "Bar::blah"; }
};
char *do_blah(Foo *f) {
return f->blah();
}
char *do_blah(Foo *f) {
return f->blah();
}
%}

View file

@ -457,18 +457,28 @@ Swig_name_object_get(Hash *namehash, String *prefix, String *name, SwigType *dec
}
*/
/* Perform a class-based lookup (if class prefix supplied) */
if (prefix) {
if (Len(prefix)) {
tname = NewStringf("%s::%s",prefix,name);
rn = name_object_get(namehash, tname, decl, ncdecl);
Delete(tname);
if (!rn) {
String *cls = Swig_scopename_last(prefix);
if (Strcmp(cls,prefix)!= 0) {
tname = NewStringf("*::%s::%s",cls,name);
rn = name_object_get(namehash, tname, decl, ncdecl);
Delete(tname);
}
Delete(cls);
}
/* A template-based class lookup */
if (!rn && SwigType_istemplate(prefix)) {
String *tprefix = SwigType_templateprefix(prefix);
tname = NewStringf("%s::%s",tprefix,name);
rn = name_object_get(namehash, tname, decl, ncdecl);
Delete(tname);
if (Strcmp(tprefix,prefix) != 0) {
rn = Swig_name_object_get(namehash, tprefix, name, decl);
}
Delete(tprefix);
}
}