From: Jürg Billeter Date: Fri, 24 Oct 2008 16:25:18 +0000 (+0000) Subject: Remove Class and Iface structs X-Git-Tag: VALA_0_5_1~70 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=120f332bee157f2501e857b45bf440102eeffdf8;p=thirdparty%2Fvala.git Remove Class and Iface structs 2008-10-24 Jürg Billeter * vala/valanamespace.vala: * vapigen/valagirparser.vala: Remove Class and Iface structs svn path=/trunk/; revision=1901 --- diff --git a/ChangeLog b/ChangeLog index a425844f2..4d9c89ae8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-10-24 Jürg Billeter + + * vala/valanamespace.vala: + * vapigen/valagirparser.vala: + + Remove Class and Iface structs + 2008-10-24 Jürg Billeter * gobject/Makefile.am: diff --git a/vala/valanamespace.vala b/vala/valanamespace.vala index 9980d1562..c6245c08d 100644 --- a/vala/valanamespace.vala +++ b/vala/valanamespace.vala @@ -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. diff --git a/vapigen/valagirparser.vala b/vapigen/valagirparser.vala index 12d851dc8..89d3b0d6a 100644 --- a/vapigen/valagirparser.vala +++ b/vapigen/valagirparser.vala @@ -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; }