[vala] codegen: Remove incorrect check when returning arrays from async methods



commit ef22cd29f0f51adfcea391d067610a8942925041
Author: Jürg Billeter <j bitron ch>
Date:   Wed Jun 1 16:23:44 2011 +0200

    codegen: Remove incorrect check when returning arrays from async methods

 codegen/valaccodebasemodule.vala |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index cbb418e..4ffca72 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -3195,13 +3195,15 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
 			for (int dim = 1; dim <= array_type.rank; dim++) {
 				var len_l = get_result_cexpression (get_array_length_cname ("result", dim));
-				ccode.open_if (len_l);
+				var len_r = get_array_length_cexpression (stmt.return_expression, dim);
 				if (!is_in_coroutine ()) {
+					ccode.open_if (len_l);
 					len_l = new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, len_l);
+					ccode.add_assignment (len_l, len_r);
+					ccode.close ();
+				} else {
+					ccode.add_assignment (len_l, len_r);
 				}
-				var len_r = get_array_length_cexpression (stmt.return_expression, dim);
-				ccode.add_assignment (len_l, len_r);
-				ccode.close ();
 			}
 
 			set_cvalue (stmt.return_expression, get_variable_cexpression (return_expr_decl.name));



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]