better fix for typedef + inheritance

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

View file

@ -250,7 +250,14 @@ namespace TagLib
public: public:
File() {} File() {}
}; };
class AudioProperties { };
class AudioProperties {
};
class AudioPropertiesFile {
public:
typedef TagLib::File File;
};
namespace FLAC namespace FLAC
{ {
@ -260,6 +267,27 @@ namespace TagLib
Properties(File *) {} 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 { class File {
public: public:
File() {} File() {}

View file

@ -489,7 +489,7 @@ static Typetab *resolved_scope = 0;
/* Internal function */ /* Internal function */
static SwigType * static SwigType *
typedef_resolve(Typetab *s, String *base) { _typedef_resolve(Typetab *s, String *base, int look_parent) {
Hash *ttab; Hash *ttab;
SwigType *type = 0; SwigType *type = 0;
List *inherit; List *inherit;
@ -507,23 +507,25 @@ typedef_resolve(Typetab *s, String *base) {
resolved_scope = s; resolved_scope = s;
Setmark(s,0); Setmark(s,0);
} else { } 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 */ /* Hmmm. Not found in my scope. It could be in an inherited scope */
inherit = Getattr(s,k_inherit); inherit = Getattr(s,k_inherit);
if (inherit) { if (inherit) {
int i,len; int i,len;
len = Len(inherit); len = Len(inherit);
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
type = typedef_resolve(Getitem(inherit,i), base); type = _typedef_resolve(Getitem(inherit,i), base, 0);
if (type) { if (type) {
Setmark(s,0); Setmark(s,0);
break; 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); Setmark(s,0);
} }
@ -531,6 +533,12 @@ typedef_resolve(Typetab *s, String *base) {
return type; return type;
} }
static SwigType *
typedef_resolve(Typetab *s, String *base) {
return _typedef_resolve(s, base, 1);
}
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
* SwigType_typedef_resolve() * SwigType_typedef_resolve()
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */