[vala/staging] codegen: No tmp for method-calls without ref/out params returning ValueType
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] codegen: No tmp for method-calls without ref/out params returning ValueType
- Date: Sun, 19 Nov 2017 13:06:52 +0000 (UTC)
commit b71f461136823404aeedfbf8b0047a5ad3852573
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Thu Mar 9 16:52:37 2017 +0100
codegen: No tmp for method-calls without ref/out params returning ValueType
https://bugzilla.gnome.org/show_bug.cgi?id=789071
codegen/valaccodemethodcallmodule.vala | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala
index a22a4fe..03f4aaa 100644
--- a/codegen/valaccodemethodcallmodule.vala
+++ b/codegen/valaccodemethodcallmodule.vala
@@ -803,6 +803,9 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
if (m != null && m.get_format_arg_index () >= 0) {
set_cvalue (expr, ccall_expr);
+ } else if (!return_result_via_out_param && !has_ref_out_param (m)
+ && (result_type is ValueType && !result_type.is_disposable ())) {
+ set_cvalue (expr, ccall_expr);
} else if (!return_result_via_out_param) {
var temp_var = get_temp_variable (result_type, result_type.value_owned, null,
false);
var temp_ref = get_variable_cexpression (temp_var.name);
@@ -894,5 +897,17 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
return to_string_func;
}
+
+ bool has_ref_out_param (Method? m) {
+ if (m == null) {
+ return false;
+ }
+ foreach (var param in m.get_parameters ()) {
+ if (param.direction != ParameterDirection.IN) {
+ return true;
+ }
+ }
+ return false;
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]