diff options
author | AndLLA <44858649+AndLLA@users.noreply.github.com> | 2022-10-16 20:49:00 +0200 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2022-10-24 18:20:10 +0100 |
commit | 0fec14ba34c6fdfcf369ee5fe7a364937ad22866 (patch) | |
tree | 0f4d855ecb10345d86fa770e71c056658f073b34 | |
parent | deb86641653aef6a283ee468f41256862401f7eb (diff) | |
download | swig-0fec14ba34c6fdfcf369ee5fe7a364937ad22866.tar.gz |
align implementation of smartname to r class name
-rw-r--r-- | Source/Modules/r.cxx | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/Source/Modules/r.cxx b/Source/Modules/r.cxx index 18a9aa56d..3d9cab0d4 100644 --- a/Source/Modules/r.cxx +++ b/Source/Modules/r.cxx @@ -2091,21 +2091,16 @@ int R::functionWrapper(Node *n) { if (constructor) { Node * parent = Getattr(n, "parentNode"); String * smartname = Getattr(parent, "feature:smartptr"); - if (smartname) { - String * classtypeobj = 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(classtype); - Delete(smartname_fixed); - Delete(smartname_fixed_rclass); + if (smartname) { // SmartName handling - has to be aligned to the other implementation in this file + SwigType *spt = Swig_cparse_type(smartname); + String *smart = SwigType_typedef_resolve_all(spt); + String *smart_rname = SwigType_manglestr(smart); + String *smart_rname_p = NewStringf("_p%s", smart_rname); + Replaceall(tm, "$R_class", smart_rname_p); + Delete(spt); + Delete(smart); + Delete(smart_rname); + Delete(smart_rname_p); } } if (debugMode) { @@ -2334,7 +2329,7 @@ void R::registerClass(Node *n) { Printf(s_classes, "setClass('%s', contains = %s)\n", sname, base); Delete(base); String *smartptr = Getattr(n, "feature:smartptr"); - if (smartptr) { + if (smartptr) {// SmartName handling - has to be aligned to the other implementation in this file List *l = Getattr(n, "bases"); SwigType *spt = Swig_cparse_type(smartptr); String *smart = SwigType_typedef_resolve_all(spt); |