Fix classLookup and enumLookup when the global scope operator is used on objects passed by value

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11092 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2009-01-28 18:45:13 +00:00
commit 22e4cb8e52
6 changed files with 103 additions and 5 deletions

View file

@ -2960,14 +2960,9 @@ Node *Language::classLookup(SwigType *s) {
n = Getattr(classtypes, s);
if (!n) {
Symtab *stab = 0;
// SwigType *lt = SwigType_ltype(s);
// SwigType *ty1 = SwigType_typedef_resolve_all(lt);
SwigType *ty1 = SwigType_typedef_resolve_all(s);
SwigType *ty2 = SwigType_strip_qualifiers(ty1);
// Printf(stdout, " stages... ty1: %s ty2: %s\n", ty1, ty2);
// Delete(lt);
Delete(ty1);
// lt = 0;
ty1 = 0;
String *base = SwigType_base(ty2);
@ -2976,6 +2971,12 @@ Node *Language::classLookup(SwigType *s) {
Replaceall(base, "struct ", "");
Replaceall(base, "union ", "");
if (strncmp(Char(base), "::", 2) == 0) {
String *oldbase = base;
base = NewString(Char(base) + 2);
Delete(oldbase);
}
String *prefix = SwigType_prefix(ty2);
/* Do a symbol table search on the base type */
@ -3049,6 +3050,12 @@ Node *Language::enumLookup(SwigType *s) {
Replaceall(base, "enum ", "");
String *prefix = SwigType_prefix(ty2);
if (strncmp(Char(base), "::", 2) == 0) {
String *oldbase = base;
base = NewString(Char(base) + 2);
Delete(oldbase);
}
/* Look for type in symbol table */
while (!n) {
Hash *nstab;

View file

@ -840,6 +840,7 @@ SwigType *SwigType_typedef_resolve_all(SwigType *t) {
*
* Given a type declaration, this function tries to fully qualify it according to
* typedef scope rules.
* Inconsistency to be fixed: ::Foo returns ::Foo, whereas ::Foo * returns Foo *
* ----------------------------------------------------------------------------- */
SwigType *SwigType_typedef_qualified(SwigType *t) {