]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
vala: Check if ArrayType supports its given element-type in analyzer pass
authorRico Tzschichholz <ricotz@ubuntu.com>
Wed, 8 Aug 2018 14:36:38 +0000 (16:36 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Thu, 20 Sep 2018 11:44:33 +0000 (13:44 +0200)
vala/valaarraycreationexpression.vala
vala/valaarraytype.vala

index 2282d6f809f73f4a0e854d86278873bb38ecdad4..41b0f351b2ca113c8d0a278273a48c0ab0f1cddb 100644 (file)
@@ -262,6 +262,10 @@ public class Vala.ArrayCreationExpression : Expression {
                value_type = new ArrayType (element_type, rank, source_reference);
                value_type.value_owned = true;
 
+               if (!value_type.check (context)) {
+                       return false;
+               }
+
                return !error;
        }
 
index 626c60c89954b40e965c9e7c4f3c125a55ea5b05..c1d4d7f29736490745b1ce9133c3372e7d20cc00 100644 (file)
@@ -271,6 +271,17 @@ public class Vala.ArrayType : ReferenceType {
                        }
                }
 
+               if (element_type is ArrayType) {
+                       Report.error (source_reference, "Stacked arrays are not supported");
+                       return false;
+               } else if (element_type is DelegateType) {
+                       var delegate_type = (DelegateType) element_type;
+                       if (delegate_type.delegate_symbol.has_target) {
+                               Report.error (source_reference, "Delegates with target are not supported as array element type");
+                               return false;
+                       }
+               }
+
                return element_type.check (context);
        }