From ea8fe73ab8a9a2b61629e18600d7f7411fec8b10 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Tue, 30 Nov 2004 20:18:33 +0000 Subject: [PATCH] Store the complete return type for director methods. Over time, the director code can migrate to using the new "returntype" attribute rather than each language module calculating it themselves. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6798 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- SWIG/Source/Modules/lang.cxx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/SWIG/Source/Modules/lang.cxx b/SWIG/Source/Modules/lang.cxx index cb3a6ae5f..65456d88a 100644 --- a/SWIG/Source/Modules/lang.cxx +++ b/SWIG/Source/Modules/lang.cxx @@ -1514,9 +1514,6 @@ int Language::classDirectorDefaultConstructor(Node *n) { -/* ---------------------------------------------------------------------- - * Language::unrollVirtualMethods() - * ---------------------------------------------------------------------- */ static String *vtable_method_id(Node *n) { @@ -1532,6 +1529,9 @@ String *vtable_method_id(Node *n) } +/* ---------------------------------------------------------------------- + * Language::unrollVirtualMethods() + * ---------------------------------------------------------------------- */ int Language::unrollVirtualMethods(Node *n, Node *parent, Hash *vm, @@ -1594,6 +1594,16 @@ int Language::unrollVirtualMethods(Node *n, Hash *item = NewHash(); Setattr(item, "fqName", fqname); Node *m = Copy(ni); + + /* Store the complete return type - needed for non-simple return types (pointers, references etc.) */ + SwigType *ty = NewString(Getattr(m,"type")); + SwigType_push(ty,decl); + if (SwigType_isqualifier(ty)) { + SwigType_pop(ty); + } + Delete(SwigType_pop_function(ty)); + Setattr(m,"returntype", ty); + String *mname = NewStringf("%s::%s", Getattr(parent,"name"),name); /* apply the features of the original method found in the base class */ Swig_features_get(Swig_cparse_features(), 0, mname, Getattr(m,"decl"), m);