better fix for typedef + inheritance

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@8786 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2006-02-11 06:13:44 +00:00
commit ff0c451c08
2 changed files with 53 additions and 17 deletions

View file

@ -250,7 +250,14 @@ namespace TagLib
public:
File() {}
};
class AudioProperties { };
class AudioProperties {
};
class AudioPropertiesFile {
public:
typedef TagLib::File File;
};
namespace FLAC
{
@ -260,6 +267,27 @@ namespace TagLib
Properties(File *) {}
};
class PropertiesFile : public AudioPropertiesFile {
public:
PropertiesFile(File * = 0) {}
};
class PropertiesFree {
public:
PropertiesFree(File *) {}
};
class FooFilePrivate : private PropertiesFile {
public:
FooFilePrivate(File *) {}
};
class FooFile : PropertiesFile {
public:
FooFile(File *) {}
};
class File {
public:
File() {}

View file

@ -489,7 +489,7 @@ static Typetab *resolved_scope = 0;
/* Internal function */
static SwigType *
typedef_resolve(Typetab *s, String *base) {
_typedef_resolve(Typetab *s, String *base, int look_parent) {
Hash *ttab;
SwigType *type = 0;
List *inherit;
@ -507,30 +507,38 @@ typedef_resolve(Typetab *s, String *base) {
resolved_scope = s;
Setmark(s,0);
} else {
/* Hmmm. Not found in my scope. check parent */
parent = Getattr(s,k_parent);
type = parent ? typedef_resolve(parent, base) : 0;
if (!type) {
/* Hmmm. Not found in my scope. It could be in an inherited scope */
inherit = Getattr(s,k_inherit);
if (inherit) {
int i,len;
len = Len(inherit);
for (i = 0; i < len; i++) {
type = typedef_resolve(Getitem(inherit,i), base);
if (type) {
Setmark(s,0);
break;
}
/* Hmmm. Not found in my scope. It could be in an inherited scope */
inherit = Getattr(s,k_inherit);
if (inherit) {
int i,len;
len = Len(inherit);
for (i = 0; i < len; i++) {
type = _typedef_resolve(Getitem(inherit,i), base, 0);
if (type) {
Setmark(s,0);
break;
}
}
}
if (!type) {
/* Hmmm. Not found in my scope. check parent */
if (look_parent) {
parent = Getattr(s,k_parent);
type = parent ? _typedef_resolve(parent, base, 1) : 0;
}
}
Setmark(s,0);
}
}
return type;
}
static SwigType *
typedef_resolve(Typetab *s, String *base) {
return _typedef_resolve(s, base, 1);
}
/* -----------------------------------------------------------------------------
* SwigType_typedef_resolve()
* ----------------------------------------------------------------------------- */