diff --git a/SWIG/Examples/test-suite/namespace_class.i b/SWIG/Examples/test-suite/namespace_class.i index b3c660abe..e48b27f3a 100644 --- a/SWIG/Examples/test-suite/namespace_class.i +++ b/SWIG/Examples/test-suite/namespace_class.i @@ -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() {} diff --git a/SWIG/Source/Swig/typesys.c b/SWIG/Source/Swig/typesys.c index b20daf58d..6bd7017b3 100644 --- a/SWIG/Source/Swig/typesys.c +++ b/SWIG/Source/Swig/typesys.c @@ -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() * ----------------------------------------------------------------------------- */