[vala/0.40] vala: Check if ArrayType supports its given element-type in analyzer pass
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.40] vala: Check if ArrayType supports its given element-type in analyzer pass
- Date: Mon, 24 Sep 2018 08:42:56 +0000 (UTC)
commit 7c9beb0e37918817fc77a70bb4dd69399bd7b501
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 3c6fb2a93..0a7ba0f0e 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 f1ecd7b68..ea8cde2d5 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]