[vala] Fix initialization of delegate fields



commit caee17cf95a94299f6f45daabfcf0e434dd21d0a
Author: Abderrahim Kitouni <a kitouni gmail com>
Date:   Sun Mar 29 21:54:50 2009 +0200

    Fix initialization of delegate fields
    
    When initializing the delegate field at creation, its target was
    not set. Fixes part of bug 571171.
---
 gobject/valaccodebasemodule.vala |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/gobject/valaccodebasemodule.vala b/gobject/valaccodebasemodule.vala
index 6b373bb..ee3983e 100644
--- a/gobject/valaccodebasemodule.vala
+++ b/gobject/valaccodebasemodule.vala
@@ -2989,6 +2989,14 @@ internal class Vala.CCodeBaseModule : CCodeModule {
 							var rhs_array_len = head.get_array_length_cexpression (init.initializer, dim);
 							ccomma.append_expression (new CCodeAssignment (lhs, rhs_array_len));
 						}
+					} else if (f.field_type is DelegateType) {
+						if (expr.type_reference.data_type is Struct) {
+							lhs = new CCodeMemberAccess (typed_inst, get_delegate_target_cname (f.get_cname ()));
+						} else {
+							lhs = new CCodeMemberAccess.pointer (typed_inst, get_delegate_target_cname (f.get_cname ()));
+						}
+						var rhs_delegate_target = get_delegate_target_cexpression (init.initializer);
+						ccomma.append_expression (new CCodeAssignment (lhs, rhs_delegate_target));
 					}
 				} else if (init.symbol_reference is Property) {
 					var inst_ma = new MemberAccess.simple ("new");



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