Tweak Perl's director method's $result variable generation.

Use same code as other languages - no real change in output.
This commit is contained in:
William S Fulton 2017-12-14 18:58:06 +00:00
commit 589b7237e9

View file

@ -2138,27 +2138,26 @@ public:
* if the return value is a reference or const reference, a specialized typemap must * if the return value is a reference or const reference, a specialized typemap must
* handle it, including declaration of c_result ($result). * handle it, including declaration of c_result ($result).
*/ */
if (!is_void) { if (!is_void && (!ignored_method || pure_virtual)) {
if (!ignored_method || pure_virtual) { if (!SwigType_isclass(returntype)) {
if (!SwigType_isclass(returntype)) { if (!(SwigType_ispointer(returntype) || SwigType_isreference(returntype))) {
if (!(SwigType_ispointer(returntype) || SwigType_isreference(returntype))) { String *construct_result = NewStringf("= SwigValueInit< %s >()", SwigType_lstr(returntype, 0));
String *construct_result = NewStringf("= SwigValueInit< %s >()", SwigType_lstr(returntype, 0)); Wrapper_add_localv(w, "c_result", SwigType_lstr(returntype, "c_result"), construct_result, NIL);
Wrapper_add_localv(w, "c_result", SwigType_lstr(returntype, "c_result"), construct_result, NIL); Delete(construct_result);
Delete(construct_result);
} else {
Wrapper_add_localv(w, "c_result", SwigType_lstr(returntype, "c_result"), "= 0", NIL);
}
} else { } else {
String *cres = SwigType_lstr(returntype, "c_result"); Wrapper_add_localv(w, "c_result", SwigType_lstr(returntype, "c_result"), "= 0", NIL);
Printf(w->code, "%s;\n", cres);
Delete(cres);
} }
} else {
String *cres = SwigType_lstr(returntype, "c_result");
Printf(w->code, "%s;\n", cres);
Delete(cres);
} }
if (!ignored_method) { }
String *pres = NewStringf("SV *%s", Swig_cresult_name());
Wrapper_add_local(w, Swig_cresult_name(), pres); if (!is_void && !ignored_method) {
Delete(pres); String *pres = NewStringf("SV *%s", Swig_cresult_name());
} Wrapper_add_local(w, Swig_cresult_name(), pres);
Delete(pres);
} }
if (ignored_method) { if (ignored_method) {