From 33fda759d4d5fab70648726a985658df4dc835ba Mon Sep 17 00:00:00 2001 From: John Lenz Date: Sat, 16 Apr 2005 21:42:42 +0000 Subject: [PATCH] Chicken: Minor optimization to the exported constructor functions git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7157 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- SWIG/Source/Modules/chicken.cxx | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/SWIG/Source/Modules/chicken.cxx b/SWIG/Source/Modules/chicken.cxx index 6310c259d..eb2243cc7 100644 --- a/SWIG/Source/Modules/chicken.cxx +++ b/SWIG/Source/Modules/chicken.cxx @@ -69,6 +69,7 @@ static String *short_class_name = 0; static int in_class = 0; static int have_constructor = 0; static bool exporting_destructor = false; +static bool exporting_constructor = false; static String *constructor_name = 0; static String *member_name = 0; @@ -558,12 +559,17 @@ CHICKEN::functionWrapper(Node *n) /* check for chickenfastproxy flag */ if (Getattr(n, "tmap:out:chickenfastproxy")) { - /* can only do fast proxy if there are no argout paramaters... */ - if (Wrapper_check_local(f, "gswig_list_p")) { - Replaceall(tm, "$proxy", "1"); - } else { + if (exporting_constructor && clos && hide_primitive) { + /* Don't return a proxy, the wrapped CLOS class is the proxy */ Replaceall(tm, "$proxy", "0"); - return_proxy_fastcall = 1; + } else { + /* can only do fast proxy if there are no argout paramaters... */ + if (Wrapper_check_local(f, "gswig_list_p")) { + Replaceall(tm, "$proxy", "1"); + } else { + Replaceall(tm, "$proxy", "0"); + return_proxy_fastcall = 1; + } } } Printf(f->code, "%s", tm); @@ -1263,7 +1269,9 @@ CHICKEN::constructorHandler(Node *n) has_constructor_args = 0; + exporting_constructor = true; Language::constructorHandler(n); + exporting_constructor = false; has_constructor_args = 1;