[vala/wip/issue/370] WIP
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/issue/370] WIP
- Date: Tue, 21 Sep 2021 14:12:05 +0000 (UTC)
commit a586011185487f40f820d9a473fda233523ebc29
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Tue Sep 21 16:10:15 2021 +0200
WIP
vala/valaparser.vala | 33 +++++++++++++++++++++++++--------
1 file changed, 25 insertions(+), 8 deletions(-)
---
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index f75e3b25d..8bb081cc2 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -2735,8 +2735,8 @@ public class Vala.Parser : CodeVisitor {
case TokenType.NAMESPACE:
case TokenType.NEW:
case TokenType.OVERRIDE:
- case TokenType.PRIVATE:
case TokenType.PARTIAL:
+ case TokenType.PRIVATE:
case TokenType.PROTECTED:
case TokenType.PUBLIC:
case TokenType.SEALED:
@@ -2846,18 +2846,14 @@ public class Vala.Parser : CodeVisitor {
cl.is_sealed = true;
}
if (ModifierFlags.PARTIAL in flags) {
+ if (!context.experimental) {
+ Report.warning (cl.source_reference, "`partial' classes are experimental");
+ }
cl.is_partial = true;
}
if (ModifierFlags.EXTERN in flags) {
cl.is_extern = true;
}
- set_attributes (cl, attrs);
- foreach (TypeParameter type_param in type_param_list) {
- cl.add_type_parameter (type_param);
- }
- foreach (DataType base_type in base_types) {
- cl.add_base_type (base_type);
- }
var old_cl = parent.scope.lookup (cl.name) as Class;
if (old_cl != null && old_cl.is_partial) {
@@ -2871,12 +2867,33 @@ public class Vala.Parser : CodeVisitor {
cl.error = true;
return;
}
+ if (cl.is_sealed != old_cl.is_sealed) {
+ Report.error (cl.source_reference, "partial declarations of `%s' have
conflicting sealed modifiers".printf (cl.name));
+ cl.error = true;
+ return;
+ }
+
+ set_attributes (old_cl, attrs);
+ foreach (TypeParameter type_param in type_param_list) {
+ old_cl.add_type_parameter (type_param);
+ }
+ foreach (DataType base_type in base_types) {
+ old_cl.add_base_type (base_type);
+ }
parse_declarations (old_cl);
return;
}
+ set_attributes (cl, attrs);
+ foreach (TypeParameter type_param in type_param_list) {
+ cl.add_type_parameter (type_param);
+ }
+ foreach (DataType base_type in base_types) {
+ cl.add_base_type (base_type);
+ }
+
parse_declarations (cl);
// ensure there is always a default construction method
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]