From 0b68c967cbda149ceebbe5aa860d34f9cd3d1982 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20K=C3=B6ppe?= Date: Mon, 26 Apr 2004 14:05:20 +0000 Subject: [PATCH] In the generated GOOPS code, don't create methods that would not specialize any arguments; simply re-export the primitive functions. (This is a performance optimization which reduces load time and execution time.) git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5886 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/Modules/guile.cxx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Source/Modules/guile.cxx b/Source/Modules/guile.cxx index 6717d96b6..b71283949 100644 --- a/Source/Modules/guile.cxx +++ b/Source/Modules/guile.cxx @@ -711,6 +711,7 @@ public: String *overname = 0; int args_passed_as_array = 0; int scheme_argnum = 0; + bool any_specialized_arg = false; // Make a wrapper name for this String *wname = Swig_name_wrapper(iname); @@ -836,6 +837,7 @@ public: /* do input conversion */ if (goopsclassname) { Printv(method_signature, " (", argname, " ", goopsclassname, ")", NIL); + any_specialized_arg = true; } else { Printv(method_signature, " ", argname, NIL); } @@ -1132,7 +1134,14 @@ public: Printv(primitive_name, proc_name, NIL); Replaceall(method_signature, "_", "-"); Replaceall(primitive_args, "_", "-"); - if (numreq == numargs) { + if (!any_specialized_arg) { + /* If there would not be any specialized argument in + the method declaration, we simply re-export the + function. This is a performance optimization. */ + Printv(method_def, "(define ", goops_name, " ", + primitive_name, ")\n", NIL); + } + else if (numreq == numargs) { Printv(method_def, "(define-method (", goops_name, method_signature, ")\n", NIL); Printv(method_def, " (", primitive_name, primitive_args, "))\n", NIL); }