[vala/wip/gettext: 44/53] vala: Check if ArrayType supports its given element-type in analyzer pass



commit 6dbd255e042635fbdb1701069e5ee8b0d24e616a
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Wed Aug 8 16:36:38 2018 +0200

    vala: Check if ArrayType supports its given element-type in analyzer pass

 vala/valaarraycreationexpression.vala |  4 ++++
 vala/valaarraytype.vala               | 11 +++++++++++
 2 files changed, 15 insertions(+)
---
diff --git a/vala/valaarraycreationexpression.vala b/vala/valaarraycreationexpression.vala
index 2282d6f80..41b0f351b 100644
--- a/vala/valaarraycreationexpression.vala
+++ b/vala/valaarraycreationexpression.vala
@@ -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;
        }
 
diff --git a/vala/valaarraytype.vala b/vala/valaarraytype.vala
index 626c60c89..c1d4d7f29 100644
--- a/vala/valaarraytype.vala
+++ b/vala/valaarraytype.vala
@@ -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);
        }
 


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