diff options
author | AndLLA <44858649+AndLLA@users.noreply.github.com> | 2022-10-01 19:18:08 +0200 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2022-10-24 18:20:10 +0100 |
commit | a71bb2bc6e9fb09de47d6ba88a02fc54d1ef3e65 (patch) | |
tree | d0244388c3236db8303364bfbf50effe75ed02f3 | |
parent | 38c2c15e61d8f4c59d0477bad4548045f7f5916f (diff) | |
download | swig-a71bb2bc6e9fb09de47d6ba88a02fc54d1ef3e65.tar.gz |
fix naming of RClass when template of a shared_ptr
-rw-r--r-- | Source/Modules/r.cxx | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/Source/Modules/r.cxx b/Source/Modules/r.cxx index c51198fed..581a9bee1 100644 --- a/Source/Modules/r.cxx +++ b/Source/Modules/r.cxx @@ -2092,9 +2092,21 @@ int R::functionWrapper(Node *n) { Node * parent = Getattr(n, "parentNode"); String * smartname = Getattr(parent, "feature:smartptr"); if (smartname) { - smartname = getRClassName(smartname, 1, 1); - Replaceall(tm, "$R_class", smartname); - Delete(smartname); + String * classtypeobj = NewString(Getattr(parent, "classtypeobj")); // this is the correct name, e.g. ClassName(int) + String * classtype = NewString(Getattr(parent, "classtype")); // this is the "wrong" name e.g. ClassName<int> + + // we replace inside smartname ClassName<int> with ClassName<int> + String * smartname_fixed = NewString(smartname); + Replaceall(classtype, " ", ""); // classtype actually has spaces inside so we remove them + Replaceall(smartname_fixed, classtype, classtypeobj); + + String * smartname_fixed_rclass = getRClassName(smartname_fixed, 1, 1); + Replaceall(tm, "$R_class", smartname_fixed_rclass); + + Delete(classtypeobj); + Delete(classtype); + Delete(smartname_fixed); + Delete(smartname_fixed_rclass); } } if (debugMode) { |