[vala/staging] codegen: No temp-var for methods without ref/out params returning "SimpleType"
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] codegen: No temp-var for methods without ref/out params returning "SimpleType"
- Date: Mon, 24 Apr 2017 12:11:46 +0000 (UTC)
commit 8eb67e17451a6914aafd3eace97a23bc95e9045b
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Thu Mar 9 16:52:37 2017 +0100
codegen: No temp-var for methods without ref/out params returning "SimpleType"
codegen/valaccodemethodcallmodule.vala | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala
index 6202f31..ab4594e 100644
--- a/codegen/valaccodemethodcallmodule.vala
+++ b/codegen/valaccodemethodcallmodule.vala
@@ -801,6 +801,8 @@ 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.nullable) {
+ 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);
@@ -892,5 +894,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]