[vala/wip/issue/370: 2/3] WIP




commit d07118df81f381f081cdabb5132c5eca28630e01
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Tue Sep 21 14:27:30 2021 +0200

    WIP

 vala/valanamespace.vala | 53 -------------------------------------------------
 vala/valaparser.vala    | 18 +++++++++++++++++
 2 files changed, 18 insertions(+), 53 deletions(-)
---
diff --git a/vala/valanamespace.vala b/vala/valanamespace.vala
index 8dc8b9069..d62babb63 100644
--- a/vala/valanamespace.vala
+++ b/vala/valanamespace.vala
@@ -160,59 +160,6 @@ public class Vala.Namespace : Symbol {
                        cl.access = SymbolAccessibility.INTERNAL;
                }
 
-               if (cl.is_partial) {
-                       var old_cl = scope.lookup (cl.name) as Class;
-                       if (old_cl != null && old_cl.is_partial) {
-                               if (cl.access != old_cl.access) {
-                                       Report.error (cl.source_reference, "partial declarations of `%s' have 
conflicting accessiblity modifiers".printf (cl.name));
-                                       cl.error = true;
-                                       return;
-                               }
-                               if (cl.is_abstract != old_cl.is_abstract) {
-                                       Report.error (cl.source_reference, "partial declarations of `%s' have 
conflicting abstract modifiers".printf (cl.name));
-                                       cl.error = true;
-                                       return;
-                               }
-
-                               foreach (Class cls in cl.get_classes ()) {
-                                       old_cl.add_class (cls);
-                               }
-                               foreach (Struct st in cl.get_structs ()) {
-                                       old_cl.add_struct (st);
-                               }
-                               foreach (Delegate d in cl.get_delegates ()) {
-                                       old_cl.add_delegate (d);
-                               }
-                               foreach (Enum en in cl.get_enums ()) {
-                                       old_cl.add_enum (en);
-                               }
-                               foreach (Constant c in cl.get_constants ()) {
-                                       old_cl.add_constant (c);
-                               }
-                               foreach (Field f in cl.get_fields ()) {
-                                       old_cl.add_field (f);
-                               }
-                               foreach (Method m in cl.get_methods ()) {
-                                       if (m != cl.default_construction_method) {
-                                               old_cl.add_method (m);
-                                       }
-                               }
-                               foreach (Property prop in cl.get_properties ()) {
-                                       //FIXME old_cl.add_property (prop);
-                               }
-                               foreach (Signal sig in cl.get_signals ()) {
-                                       old_cl.add_signal (sig);
-                               }
-                               foreach (Attribute a in cl.attributes) {
-                                       if (old_cl.get_attribute (a.name) == null) {
-                                               old_cl.attributes.append(a);
-                                       }
-                               }
-
-                               return;
-                       }
-               }
-
                if (cl.owner == null) {
                        cl.source_reference.file.add_node (cl);
                }
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index 0aa50e7d7..f75e3b25d 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -2859,6 +2859,24 @@ public class Vala.Parser : CodeVisitor {
                        cl.add_base_type (base_type);
                }
 
+               var old_cl = parent.scope.lookup (cl.name) as Class;
+               if (old_cl != null && old_cl.is_partial) {
+                       if (cl.access != old_cl.access) {
+                               Report.error (cl.source_reference, "partial declarations of `%s' have 
conflicting accessiblity modifiers".printf (cl.name));
+                               cl.error = true;
+                               return;
+                       }
+                       if (cl.is_abstract != old_cl.is_abstract) {
+                               Report.error (cl.source_reference, "partial declarations of `%s' have 
conflicting abstract modifiers".printf (cl.name));
+                               cl.error = true;
+                               return;
+                       }
+
+                       parse_declarations (old_cl);
+
+                       return;
+               }
+
                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]