[vala] Fix struct initialization in async methods



commit bda10833d6eb0033a2e1b50e299237a27ee05dd4
Author: Jürg Billeter <j bitron ch>
Date:   Sun Mar 21 23:13:12 2010 +0100

    Fix struct initialization in async methods

 codegen/valaccodebasemodule.vala |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 0c0e00b..1beb9fa 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -2208,7 +2208,12 @@ internal class Vala.CCodeBaseModule : CCodeModule {
 			closure_struct.add_field (local.variable_type.get_cname (), get_variable_cname (local.name) + local.variable_type.get_cdeclarator_suffix ());
 
 			if (local.initializer != null) {
-				cfrag.append (new CCodeExpressionStatement (new CCodeAssignment (new CCodeMemberAccess.pointer (new CCodeIdentifier ("data"), get_variable_cname (local.name)), rhs)));
+				var st = local.variable_type.data_type as Struct;
+				if (st != null && (!st.is_simple_type () || st.get_cname () == "va_list") && !local.variable_type.nullable && local.initializer is ObjectCreationExpression) {
+					cfrag.append (new CCodeExpressionStatement (rhs));
+				} else {
+					cfrag.append (new CCodeExpressionStatement (new CCodeAssignment (new CCodeMemberAccess.pointer (new CCodeIdentifier ("data"), get_variable_cname (local.name)), rhs)));
+				}
 			}
 		} else {
 			CCodeStatement post_stmt = null;



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