]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Small change to make code a bit clearer. Fixes bug #535942
authorJaap A. Haitsma <jaap@haitsma.org>
Sun, 1 Jun 2008 16:58:25 +0000 (16:58 +0000)
committerJaap A. Haitsma <jhaitsma@src.gnome.org>
Sun, 1 Jun 2008 16:58:25 +0000 (16:58 +0000)
2008-06-01  Jaap A. Haitsma  <jaap@haitsma.org>

* vala/valasemanticanalyzer.vala:
Small change to make code a bit clearer. Fixes bug #535942

svn path=/trunk/; revision=1533

ChangeLog
vala/valasemanticanalyzer.vala

index 55ffa59b7bb1f2dc2fcb86778decf8a7d5e82fed..db88c0a3c5e77bbf806bd5a87e1fd1ef04167498 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-06-01  Jaap A. Haitsma  <jaap@haitsma.org>
+
+       * vala/valasemanticanalyzer.vala:
+       Small change to make code a bit clearer. Fixes bug #535942
+
 2008-06-01  Jaap A. Haitsma  <jaap@haitsma.org>
 
        * vapi/gstreamer-0.10.vapi:
index 5ead04bc2b0ca71c8e5d0171bd66bbc2ae1fd383..395212e7281ad59cece7fffffb8333dec2e5b5e9 100644 (file)
@@ -822,14 +822,18 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
         * @param list an initializer list
         */
        public override void visit_initializer_list (InitializerList list) {
-               if (list.target_type is ArrayType) {
+               if (list.target_type == null) {
+                       list.error = true;
+                       Report.error (list.source_reference, "initializer list used for unknown type");
+                       return;
+               } else if (list.target_type is ArrayType) {
                        /* initializer is used as array initializer */
                        var array_type = (ArrayType) list.target_type;
 
                        foreach (Expression e in list.get_initializers ()) {
                                e.target_type = array_type.element_type.copy ();
                        }
-               } else if (list.target_type != null && list.target_type.data_type is Struct) {
+               } else if (list.target_type.data_type is Struct) {
                        /* initializer is used as struct initializer */
                        var st = (Struct) list.target_type.data_type;
 
@@ -854,10 +858,6 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
                                        e.target_type.value_owned = false;
                                }
                        }
-               } else if (list.target_type == null) {
-                       list.error = true;
-                       Report.error (list.source_reference, "initializer list used for unknown type");
-                       return;
                } else {
                        list.error = true;
                        Report.error (list.source_reference, "initializer list used for `%s', which is neither array nor struct".printf (list.target_type.to_string ()));