]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
libvaladoc: register child structs
authorFlorian Brosch <flo.brosch@gmail.com>
Fri, 10 Aug 2012 00:33:25 +0000 (02:33 +0200)
committerFlorian Brosch <flo.brosch@gmail.com>
Fri, 10 Aug 2012 00:33:25 +0000 (02:33 +0200)
src/libvaladoc/api/childsymbolregistrar.vala
src/libvaladoc/api/struct.vala

index c3288e0130075dc02b38f2fd419f2e3d8d4c80db..e044327b038d3111a6b4c2966eab24b3a357e745 100644 (file)
@@ -82,6 +82,10 @@ public class Valadoc.Api.ChildSymbolRegistrar : Visitor {
         * {@inheritDoc}
         */
        public override void visit_struct (Struct item) {
+               if (item.base_type != null) {
+                       ((Struct) item.base_type.data_type).register_child_struct (item);
+               }
+
                item.accept_all_children (this, false);
        }
 
index 52bcb6b3d9f37fb0c706127f1458de036891955a..302494857c63ab4a4dd82f01686e5dbf61145b49 100644 (file)
@@ -95,6 +95,24 @@ public class Valadoc.Api.Struct : TypeSymbol {
        }
 
 
+       private Set<Struct> _known_child_structs = new TreeSet<Struct> ();
+
+       /**
+        * Returns a list of all known structs based on this struct
+        */
+       public Collection<Struct> get_known_child_structs () {
+               return _known_child_structs.read_only_view;
+       }
+
+       public void register_child_struct (Struct stru) {
+               if (this.base_type != null) {
+                       ((Struct) this.base_type.data_type).register_child_struct (stru);
+               }
+
+               _known_child_structs.add (stru);
+       }
+
+
        /**
         * {@inheritDoc}
         */