diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y index 4d4401572..b8691ab9c 100644 --- a/Source/CParse/parser.y +++ b/Source/CParse/parser.y @@ -2644,6 +2644,7 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va n = Swig_cparse_template_locate($5,$7,tscope); /* Patch the argument types to respect namespaces */ +Printf(stdout, " p before patching: %s\n", ParmList_str_defaultargs($7)); p = $7; while (p) { SwigType *value = Getattr(p,"value"); @@ -2669,6 +2670,7 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va p = nextSibling(p); } +Printf(stdout, " p after patching: %s\n", ParmList_str_defaultargs($7)); /* Look for the template */ { @@ -2746,6 +2748,7 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va def_supplied = 1; } } +Printf(stdout, " p tempar patching: %s\n", ParmList_str_defaultargs(temparms)); templnode = copy_node(nn); /* We need to set the node name based on name used to instantiate */ diff --git a/Source/Swig/parms.c b/Source/Swig/parms.c index 9b58f5fcb..6b0863ee4 100644 --- a/Source/Swig/parms.c +++ b/Source/Swig/parms.c @@ -114,6 +114,14 @@ int ParmList_len(ParmList *p) { return i; } +/* --------------------------------------------------------------------- + * get_empty_type() + * ---------------------------------------------------------------------- */ + +static SwigType *get_empty_type() { + return NewStringEmpty(); +} + /* --------------------------------------------------------------------- * ParmList_str() * @@ -123,7 +131,8 @@ int ParmList_len(ParmList *p) { String *ParmList_str(ParmList *p) { String *out = NewStringEmpty(); while (p) { - String *pstr = SwigType_str(Getattr(p, "type"), Getattr(p, "name")); + String *type = Getattr(p, "type"); + String *pstr = SwigType_str(type ? type : get_empty_type(), Getattr(p, "name")); Append(out, pstr); p = nextSibling(p); if (p) { @@ -144,7 +153,8 @@ String *ParmList_str_defaultargs(ParmList *p) { String *out = NewStringEmpty(); while (p) { String *value = Getattr(p, "value"); - String *pstr = SwigType_str(Getattr(p, "type"), Getattr(p, "name")); + String *type = Getattr(p, "type"); + String *pstr = SwigType_str(type ? type : get_empty_type(), Getattr(p, "name")); Append(out, pstr); if (value) { Printf(out, "=%s", value); @@ -167,7 +177,8 @@ String *ParmList_str_defaultargs(ParmList *p) { String *ParmList_protostr(ParmList *p) { String *out = NewStringEmpty(); while (p) { - String *pstr = SwigType_str(Getattr(p, "type"), 0); + String *type = Getattr(p, "type"); + String *pstr = SwigType_str(type ? type : get_empty_type(), 0); Append(out, pstr); p = nextSibling(p); if (p) {