Fix typemap method hiding regression introduced in swig-2.0.5 - rev 12764

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13071 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2012-05-11 21:23:37 +00:00
commit ef7a8a8253
5 changed files with 73 additions and 12 deletions

View file

@ -89,13 +89,16 @@ static Hash *get_typemap(int tm_scope, const SwigType *type) {
return tm;
}
static void set_typemap(int tm_scope, const SwigType *type, Hash *tm) {
static void set_typemap(int tm_scope, const SwigType *type, Hash **tmhash) {
SwigType *hashtype = 0;
Hash *new_tm = 0;
assert(*tmhash == 0);
if (SwigType_istemplate(type)) {
SwigType *rty = SwigType_typedef_resolve_all(type);
String *ty = Swig_symbol_template_deftype(rty, 0);
String *tyq = Swig_symbol_type_qualify(ty, 0);
hashtype = SwigType_remove_global_scope_prefix(tyq);
*tmhash = Getattr(typemaps[tm_scope], hashtype);
Delete(rty);
Delete(tyq);
Delete(ty);
@ -103,10 +106,17 @@ static void set_typemap(int tm_scope, const SwigType *type, Hash *tm) {
hashtype = SwigType_remove_global_scope_prefix(type);
}
if (!*tmhash) {
/* this type has not been seen before even after resolving template parameter types */
new_tm = NewHash();
*tmhash = new_tm;
}
/* note that the unary scope operator (::) prefix indicating global scope has been removed from the type */
Setattr(typemaps[tm_scope], hashtype, tm);
Setattr(typemaps[tm_scope], hashtype, *tmhash);
Delete(hashtype);
Delete(new_tm);
}
@ -210,9 +220,7 @@ static void typemap_register(const_String_or_char_ptr tmap_method, ParmList *par
/* See if this type has been seen before */
tm = get_typemap(tm_scope, type);
if (!tm) {
tm = NewHash();
set_typemap(tm_scope, type, tm);
Delete(tm);
set_typemap(tm_scope, type, &tm);
}
if (pname) {
/* See if parameter has been seen before */
@ -476,9 +484,7 @@ int Swig_typemap_apply(ParmList *src, ParmList *dest) {
type = Getattr(lastdp, "type");
tm = get_typemap(tm_scope, type);
if (!tm) {
tm = NewHash();
set_typemap(tm_scope, type, tm);
Delete(tm);
set_typemap(tm_scope, type, &tm);
}
name = Getattr(lastdp, "name");
if (name) {