@@ -2091,21 +2091,16 @@ int R::functionWrapper(Node *n) {
2091
2091
if (constructor) {
2092
2092
Node * parent = Getattr (n, " parentNode" );
2093
2093
String * smartname = Getattr (parent, " feature:smartptr" );
2094
- if (smartname) {
2095
- String * classtypeobj = Getattr (parent, " classtypeobj" ); // this is the correct name, e.g. ClassName(int)
2096
- String * classtype = NewString (Getattr (parent, " classtype" )); // this is the "wrong" name e.g. ClassName<int>
2097
-
2098
- // we replace inside smartname ClassName<int> with ClassName(int)
2099
- String * smartname_fixed = NewString (smartname);
2100
- Replaceall (classtype, " " , " " ); // classtype actually has spaces inside so we remove them
2101
- Replaceall (smartname_fixed, classtype, classtypeobj);
2102
-
2103
- String * smartname_fixed_rclass = getRClassName (smartname_fixed, 1 , 1 );
2104
- Replaceall (tm, " $R_class" , smartname_fixed_rclass);
2105
-
2106
- Delete (classtype);
2107
- Delete (smartname_fixed);
2108
- Delete (smartname_fixed_rclass);
2094
+ if (smartname) { // SmartName handling - has to be aligned to the other implementation in this file
2095
+ SwigType *spt = Swig_cparse_type (smartname);
2096
+ String *smart = SwigType_typedef_resolve_all (spt);
2097
+ String *smart_rname = SwigType_manglestr (smart);
2098
+ String *smart_rname_p = NewStringf (" _p%s" , smart_rname);
2099
+ Replaceall (tm, " $R_class" , smart_rname_p);
2100
+ Delete (spt);
2101
+ Delete (smart);
2102
+ Delete (smart_rname);
2103
+ Delete (smart_rname_p);
2109
2104
}
2110
2105
}
2111
2106
if (debugMode) {
@@ -2334,7 +2329,7 @@ void R::registerClass(Node *n) {
2334
2329
Printf (s_classes, " setClass('%s', contains = %s)\n " , sname, base);
2335
2330
Delete (base);
2336
2331
String *smartptr = Getattr (n, " feature:smartptr" );
2337
- if (smartptr) {
2332
+ if (smartptr) {// SmartName handling - has to be aligned to the other implementation in this file
2338
2333
List *l = Getattr (n, " bases" );
2339
2334
SwigType *spt = Swig_cparse_type (smartptr);
2340
2335
String *smart = SwigType_typedef_resolve_all (spt);
0 commit comments