Skip to content

Commit 0fec14b

Browse files
AndLLAwsfulton
authored andcommitted
align implementation of smartname to r class name
1 parent deb8664 commit 0fec14b

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

Source/Modules/r.cxx

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2091,21 +2091,16 @@ int R::functionWrapper(Node *n) {
20912091
if (constructor) {
20922092
Node * parent = Getattr(n, "parentNode");
20932093
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);
21092104
}
21102105
}
21112106
if (debugMode) {
@@ -2334,7 +2329,7 @@ void R::registerClass(Node *n) {
23342329
Printf(s_classes, "setClass('%s', contains = %s)\n", sname, base);
23352330
Delete(base);
23362331
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
23382333
List *l = Getattr(n, "bases");
23392334
SwigType *spt = Swig_cparse_type(smartptr);
23402335
String *smart = SwigType_typedef_resolve_all(spt);

0 commit comments

Comments
 (0)