[vala/switch-to-gir] girparser: Skip creating structs for *Class and *Iface



commit 897a4e15ca8c5d595f753bd15b56db0ccd83161c
Author: Luca Bruno <lethalman88 gmail com>
Date:   Tue Aug 24 10:52:05 2010 +0200

    girparser: Skip creating structs for *Class and *Iface

 vala/valagirparser.vala |   36 +++++++-----------------------------
 1 files changed, 7 insertions(+), 29 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 470f377..fe51bc1 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -75,34 +75,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;
 	}
@@ -639,7 +611,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;
@@ -686,6 +658,12 @@ public class Vala.GirParser : CodeVisitor {
 			}
 		}
 		end_element ("record");
+
+		if (glib_is_gtype_struct_for != null) {
+			// skip *Class or *Iface
+			return null;
+		}
+
 		return st;
 	}
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]