]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Remove Class and Iface structs
authorJürg Billeter <j@bitron.ch>
Fri, 24 Oct 2008 16:25:18 +0000 (16:25 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Fri, 24 Oct 2008 16:25:18 +0000 (16:25 +0000)
2008-10-24  Jürg Billeter  <j@bitron.ch>

* vala/valanamespace.vala:
* vapigen/valagirparser.vala:

Remove Class and Iface structs

svn path=/trunk/; revision=1901

ChangeLog
vala/valanamespace.vala
vapigen/valagirparser.vala

index a425844f2b417912f2c4f87fa670cbe0200cd3f4..4d9c89ae853de0a4d6f121ae9ee9c39fee6ac893 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-10-24  Jürg Billeter  <j@bitron.ch>
+
+       * vala/valanamespace.vala:
+       * vapigen/valagirparser.vala:
+
+       Remove Class and Iface structs
+
 2008-10-24  Jürg Billeter  <j@bitron.ch>
 
        * gobject/Makefile.am:
index 9980d156210043f6aa536e8462bb8216c691a0ef..c6245c08d49d43a6e7801a3553ba1ce62be7d079 100644 (file)
@@ -166,6 +166,16 @@ public class Vala.Namespace : Symbol {
                structs.add (st);
                scope.add (st.name, st);
        }
+       
+       /**
+        * Removes the specified struct from this namespace.
+        *
+        * @param st a struct
+        */
+       public void remove_struct (Struct st) {
+               structs.remove (st);
+               scope.remove (st.name);
+       }
                        
        /**
         * Adds the specified enum to this namespace.
index 12d851dc8ebe87b5b04847cfa2f1334c16a4d3fb..89d3b0d6a03ef35cc66bc9f71c42682bdf793503 100644 (file)
@@ -66,6 +66,28 @@ public class Vala.GirParser : CodeVisitor {
                next ();
                parse_repository ();
 
+               foreach (CodeNode node in source_file.get_nodes ()) {
+                       if (node is Class) {
+                               var cl = (Class) node;
+                               var ns = cl.parent_symbol as Namespace;
+                               // remove Class records
+                               var class_struct = ns.scope.lookup (cl.name + "Class") as Struct;
+                               if (class_struct != null) {
+                                       ns.remove_struct ((Struct) class_struct);
+                                       source_file.remove_node (class_struct);
+                               }
+                       } else if (node is Interface) {
+                               var iface = (Interface) node;
+                               var ns = iface.parent_symbol as Namespace;
+                               // remove Iface records
+                               var iface_struct = ns.scope.lookup (iface.name + "Iface") as Struct;
+                               if (iface_struct != null) {
+                                       ns.remove_struct ((Struct) iface_struct);
+                                       source_file.remove_node (iface_struct);
+                               }
+                       }
+               }
+
                reader = null;
                this.current_source_file = null;
        }