]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Set the type of initializer lists to be non-nullable
authorLuca Bruno <lucabru@src.gnome.org>
Sun, 7 Aug 2011 19:05:33 +0000 (21:05 +0200)
committerLuca Bruno <lucabru@src.gnome.org>
Thu, 11 Aug 2011 08:31:42 +0000 (10:31 +0200)
codegen/valaccodebasemodule.vala
tests/structs/structs.vala
vala/valainitializerlist.vala

index 26f88eee27133da6e1256362652be865802a4508..b9208e7086c721bd81d67f1092f303f8603b0a41 100644 (file)
@@ -2256,7 +2256,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                set_cvalue (list, clist);
                        } else {
                                // used as expression
-                               var instance = create_temp_value (list.target_type, true, list);
+                               var instance = create_temp_value (list.value_type, true, list);
 
                                var field_it = st.get_fields ().iterator ();
                                foreach (Expression expr in list.get_initializers ()) {
index 2a5c06c476fb56da783ebbaf28056e574ec4470a..2e4ed7cb7bc4bf1d288d616a694e9639147d50c0 100644 (file)
@@ -68,6 +68,7 @@ void main () {
        stdout.printf ("simple_struct.field = %d\n", simple_struct.field);
 
        test_in_parameter (simple_struct);
+       test_in_parameter ({1});
        test_in_nullable_parameter (simple_struct);
        test_ref_parameter (ref simple_struct);
        stdout.printf ("after test_ref_parameter: st.field = %d\n", simple_struct.field);
index e99a415f5a4a8577cccc1a30cf9781f720847987..b2350aee64239b59a9285021b3736c82f8d84d82 100644 (file)
@@ -74,6 +74,8 @@ public class Vala.InitializerList : Expression {
 
        public override void accept (CodeVisitor visitor) {
                visitor.visit_initializer_list (this);
+
+               visitor.visit_expression (this);
        }
 
        public override bool is_constant () {
@@ -203,7 +205,8 @@ public class Vala.InitializerList : Expression {
 
                if (!error) {
                        /* everything seems to be correct */
-                       value_type = target_type;
+                       value_type = target_type.copy ();
+                       value_type.nullable = false;
                }
 
                return !error;
@@ -215,5 +218,7 @@ public class Vala.InitializerList : Expression {
                }
 
                codegen.visit_initializer_list (this);
+
+               codegen.visit_expression (this);
        }
 }