]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
girparser: Skip creating structs for *Class and *Iface
authorLuca Bruno <lethalman88@gmail.com>
Tue, 24 Aug 2010 08:52:05 +0000 (10:52 +0200)
committerEvan Nemerson <evan@coeus-group.com>
Mon, 8 Nov 2010 09:43:18 +0000 (01:43 -0800)
vala/valagirparser.vala

index 2c132fd9aa2b7921125e2876c53d64a89f5afbb2..86b332b06fa182391b3160ca54222db9ae8db341 100644 (file)
@@ -541,34 +541,6 @@ public class Vala.GirParser : CodeVisitor {
                next ();
                parse_repository ();
 
-               var remove_queue = new ArrayList<CodeNode> ();
-
-               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);
-                                       remove_queue.add (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);
-                                       remove_queue.add (iface_struct);
-                               }
-                       }
-               }
-
-               foreach (CodeNode node in remove_queue) {
-                       source_file.remove_node (node);
-               }
-
                reader = null;
                this.current_source_file = null;
        }
@@ -1206,7 +1178,7 @@ public class Vala.GirParser : CodeVisitor {
                return type;
        }
 
-       Struct parse_record () {
+       Struct? parse_record () {
                start_element ("record");
                var st = new Struct (reader.get_attribute ("name"), get_current_src ());
                st.external = true;
@@ -1242,6 +1214,13 @@ public class Vala.GirParser : CodeVisitor {
                        }
                }
                end_element ("record");
+
+               if (current_gtype_struct_for != null) {
+                       // skip *Class or *Iface
+                       current_gtype_struct_for = null;
+                       return null;
+               }
+
                return st;
        }