]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
libvaladoc: Allow to inherit documentation from other packages. (#629531)
authorFlorian Brosch <flo.brosch@gmail.com>
Thu, 28 Oct 2010 17:36:57 +0000 (19:36 +0200)
committerFlorian Brosch <flo.brosch@gmail.com>
Thu, 28 Oct 2010 17:36:57 +0000 (19:36 +0200)
src/libvaladoc/api/tree.vala
src/libvaladoc/taglets/tagletinheritdoc.vala

index 2bcb5a971671b73013714ba1a38cfd2ec74b843b..f65d9a20f5e82e9943e9f1de21899ada029484a6 100644 (file)
@@ -28,6 +28,7 @@ private Valadoc.Api.Class glib_error = null;
 
 
 public class Valadoc.Api.Tree {
+       private Deque<Node> unbrowsable_documentation_dependencies = new LinkedList<Node>();
        private ArrayList<Package> packages = new ArrayList<Package>();
        private Package source_package = null;
        private Settings settings;
@@ -49,6 +50,10 @@ public class Valadoc.Api.Tree {
                return this.packages.read_only_view;
        }
 
+       internal bool push_unbrowsable_documentation_dependency (Api.Node node) {
+               return unbrowsable_documentation_dependencies.offer_head (node);
+       }
+
        private void add_dependencies_to_source_package () {
                if ( this.source_package != null ) {
                        ArrayList<Package> deplst = new ArrayList<Package> ();
@@ -188,8 +193,7 @@ public class Valadoc.Api.Tree {
                        if (!add_package ("posix")) {
                                Vala.Report.error (null, "posix not found in specified Vala API directories");
                        }
-               }
-               else if (context.profile == Vala.Profile.GOBJECT) {
+               } else if (context.profile == Vala.Profile.GOBJECT) {
                        int glib_major = 2;
                        int glib_minor = 12;
 
@@ -405,14 +409,19 @@ public class Valadoc.Api.Tree {
 
        // TODO Rename to process_comments
        public void parse_comments (DocumentationParser docparser) {
-               // TODO Move Wiki tree parse to Package
                process_wiki (docparser);
 
                foreach (Package pkg in this.packages) {
                        if (pkg.is_browsable (settings)) {
-                               pkg.process_comments(settings, docparser);
+                               pkg.process_comments (settings, docparser);
                        }
                }
+
+               // parse inherited non-public comments
+               while (!this.unbrowsable_documentation_dependencies.is_empty) {
+                       var node = this.unbrowsable_documentation_dependencies.poll_head ();
+                       node.process_comments (settings, docparser);
+               }
        }
 
        public void import_documentation (DocumentationImporter[] importers, string[] packages, string[] import_directories) {
index 71054304687fdd5f3cd46c0aae0e2738bb73fcd9..4f4568faa658f7274601d3e1e0b54a45f05796ca 100755 (executable)
@@ -44,6 +44,10 @@ public class Valadoc.Taglets.InheritDoc : InlineTaglet {
                        _inherited = (Api.Node) ((Api.Struct) container).base_type.data_type;
                }
 
+               if (_inherited != null) {
+                       api_root.push_unbrowsable_documentation_dependency (_inherited);
+               }
+
                // TODO report error if inherited is null
 
                // TODO postpone check after complete parse of the api tree comments
@@ -52,7 +56,7 @@ public class Valadoc.Taglets.InheritDoc : InlineTaglet {
        }
 
        public override ContentElement produce_content () {
-               if (_inherited != null) {
+               if (_inherited != null && _inherited.documentation != null) {
                        Paragraph inherited_paragraph = _inherited.documentation.content.get (0) as Paragraph;
 
                        Run paragraph = new Run (Run.Style.NONE);