[vala/0.42] 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.42] vala: Check if ArrayType supports its given element-type in analyzer pass
- Date: Sun, 23 Sep 2018 09:05:50 +0000 (UTC)
commit 4417770707b24e6c444ee0793e7284837e09c09f
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]