From 1738d4e5c15094e285edc289b03a4a1ad5796aa7 Mon Sep 17 00:00:00 2001 From: Dave Beazley Date: Wed, 23 Apr 2003 17:59:06 +0000 Subject: [PATCH] Fixed nested namespace resolution problem. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4699 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/Swig/typesys.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/Source/Swig/typesys.c b/Source/Swig/typesys.c index 9adfe6530..95635d050 100644 --- a/Source/Swig/typesys.c +++ b/Source/Swig/typesys.c @@ -785,12 +785,13 @@ SwigType *SwigType_typedef_qualified(SwigType *t) String *result; int i,len; - if (!typedef_qualified_cache) typedef_qualified_cache = NewHash(); + if (!typedef_qualified_cache) typedef_qualified_cache = NewHash(); result = Getattr(typedef_qualified_cache,t); if (result) { String *rc = Copy(result); return rc; } + result = NewString(""); elements = SwigType_split(t); len = Len(elements); @@ -817,7 +818,6 @@ SwigType *SwigType_typedef_qualified(SwigType *t) } } } else { - if (Swig_scopename_check(e)) { String *tqname; String *qlast; @@ -832,7 +832,27 @@ SwigType *SwigType_typedef_qualified(SwigType *t) Delete(tqname); } /* Automatic template instantiation might go here??? */ - + } else { + /* It's a bare name. It's entirely possible, that the + name is part of a namespace. We'll check this by unrolling + out of the current scope */ + + Typetab *cs = current_scope; + while (cs) { + String *qs = SwigType_scope_name(cs); + if (Len(qs)) { + Append(qs,"::"); + } + Append(qs,e); + if (Getattr(scopes,qs)) { + Clear(e); + Append(e,qs); + Delete(qs); + break; + } + Delete(qs); + cs = Getattr(cs,"parent"); + } } } if (isenum) e = isenum;