fix features/rename for template constructors/destructors

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@8127 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2005-12-30 00:00:32 +00:00
commit d5cf7892d5

View file

@ -18,7 +18,7 @@ char cvsroot_naming_c[] = "$Header$";
static Hash *naming_hash = 0; static Hash *naming_hash = 0;
/* #define SWIG_DEBUG */ /* #define SWIG_DEBUG */
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
* Swig_name_register() * Swig_name_register()
* *
@ -460,7 +460,6 @@ Swig_name_object_get(Hash *namehash, String *prefix, String *name, SwigType *dec
} }
*/ */
/* Perform a class-based lookup (if class prefix supplied) */ /* Perform a class-based lookup (if class prefix supplied) */
if (prefix) { if (prefix) {
if (Len(prefix)) { if (Len(prefix)) {
@ -476,11 +475,21 @@ Swig_name_object_get(Hash *namehash, String *prefix, String *name, SwigType *dec
} }
Delete(cls); Delete(cls);
} }
/* A template-based class lookup, check name first */
if (!rn && SwigType_istemplate(name)) {
String *tname = SwigType_templateprefix(name);
if (Strcmp(tname,name) != 0) {
rn = Swig_name_object_get(namehash, prefix, tname, decl);
}
Delete(tname);
}
/* A template-based class lookup */ /* A template-based class lookup */
if (!rn && SwigType_istemplate(prefix)) { if (!rn && SwigType_istemplate(prefix)) {
String *tprefix = SwigType_templateprefix(prefix); String *tprefix = SwigType_templateprefix(prefix);
if (Strcmp(tprefix,prefix) != 0) { if (Strcmp(tprefix,prefix) != 0) {
rn = Swig_name_object_get(namehash, tprefix, name, decl); String *tname = SwigType_templateprefix(name);
rn = Swig_name_object_get(namehash, tprefix, tname, decl);
Delete(tname);
} }
Delete(tprefix); Delete(tprefix);
} }
@ -608,7 +617,21 @@ Swig_features_get(Hash *features, String *prefix, String *name, SwigType *decl,
if (name && SwigType_istemplate(name) && if (name && SwigType_istemplate(name) &&
((Strcmp(nodeType(node),"constructor") == 0) ((Strcmp(nodeType(node),"constructor") == 0)
|| (Strcmp(nodeType(node),"destructor") == 0))) { || (Strcmp(nodeType(node),"destructor") == 0))) {
rname = SwigType_templateprefix(name); String *prefix = NewStringEmpty();
String *last = NewStringEmpty();
String *tprefix;
Swig_scopename_split(name, &prefix, &last);
tprefix = SwigType_templateprefix(last);
Delete(last);
if (Len(prefix)) {
Append(prefix,"::");
Append(prefix,tprefix);
Delete(tprefix);
rname = prefix;
} else {
rname = tprefix;
Delete(prefix);
}
rdecl = Copy(decl); rdecl = Copy(decl);
Replaceall(rdecl,name,rname); Replaceall(rdecl,name,rname);
decl = rdecl; decl = rdecl;