]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Fix critical and generated code for static delegate fields, fixes bug
authorJürg Billeter <j@bitron.ch>
Fri, 9 Jan 2009 23:09:11 +0000 (23:09 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Fri, 9 Jan 2009 23:09:11 +0000 (23:09 +0000)
2009-01-10  Jürg Billeter  <j@bitron.ch>

* gobject/valaccodebasemodule.vala:
* gobject/valaccodedelegatemodule.vala:

Fix critical and generated code for static delegate fields,
fixes bug 563016

svn path=/trunk/; revision=2316

ChangeLog
gobject/valaccodebasemodule.vala
gobject/valaccodedelegatemodule.vala

index 892604af0876f408b915dff2f1095be9a233dc4a..d5a963eb581be959a2245542468902125e087844 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2009-01-10  Jürg Billeter  <j@bitron.ch>
+
+       * gobject/valaccodebasemodule.vala:
+       * gobject/valaccodedelegatemodule.vala:
+
+       Fix critical and generated code for static delegate fields,
+       fixes bug 563016
+
 2009-01-10  Jürg Billeter  <j@bitron.ch>
 
        * vala/valafield.vala:
index 2cb23a7f99b1f6408223fade611fc2bb8beb3af5..2eb738a14579cb190a329bedbe6c81e0cf6720f8 100644 (file)
@@ -3581,7 +3581,8 @@ public class Vala.CCodeBaseModule : CCodeModule {
        }
 
        public CCodeExpression? default_value_for_type (DataType type, bool initializer_expression) {
-               if ((type.data_type != null && type.data_type.is_reference_type ()) || type is PointerType || type is ArrayType) {
+               if ((type.data_type != null && type.data_type.is_reference_type ())
+                   || type is PointerType || type is ArrayType || type is DelegateType) {
                        return new CCodeConstant ("NULL");
                } else if (type.data_type != null && type.data_type.get_default_value () != null) {
                        return new CCodeConstant (type.data_type.get_default_value ());
index ecdaedb9a5e950787695c1c70db9ba334466f011..db18d00921f955637846442daa5237b7c6c3d5f6 100644 (file)
@@ -1,6 +1,7 @@
 /* valaccodedelegatemodule.vala
  *
- * Copyright (C) 2006-2008  Jürg Billeter, Raffaele Sandrini
+ * Copyright (C) 2006-2009  Jürg Billeter
+ * Copyright (C) 2006-2008  Raffaele Sandrini
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -123,14 +124,13 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
 
                                var ma = (MemberAccess) delegate_expr;
 
-                               var base_type = ma.inner.value_type;
                                CCodeExpression target_expr = null;
 
-                               var pub_inst = (CCodeExpression) get_ccodenode (ma.inner);
-
                                if (field.binding == MemberBinding.INSTANCE) {
-                                       var instance_expression_type = base_type;
+                                       var instance_expression_type = ma.inner.value_type;
                                        var instance_target_type = get_data_type_for_symbol ((TypeSymbol) field.parent_symbol);
+
+                                       var pub_inst = (CCodeExpression) get_ccodenode (ma.inner);
                                        CCodeExpression typed_inst = transform_expression (pub_inst, instance_expression_type, instance_target_type);
 
                                        CCodeExpression inst;