Skip to content

Commit a71bb2b

Browse files
AndLLAwsfulton
authored andcommitted
fix naming of RClass when template of a shared_ptr
1 parent 38c2c15 commit a71bb2b

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

Source/Modules/r.cxx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2092,9 +2092,21 @@ int R::functionWrapper(Node *n) {
20922092
Node * parent = Getattr(n, "parentNode");
20932093
String * smartname = Getattr(parent, "feature:smartptr");
20942094
if (smartname) {
2095-
smartname = getRClassName(smartname, 1, 1);
2096-
Replaceall(tm, "$R_class", smartname);
2097-
Delete(smartname);
2095+
String * classtypeobj = NewString(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(classtypeobj);
2107+
Delete(classtype);
2108+
Delete(smartname_fixed);
2109+
Delete(smartname_fixed_rclass);
20982110
}
20992111
}
21002112
if (debugMode) {

0 commit comments

Comments
 (0)