src/doc: fix DocComposite::parent linking
authorAlexandre Terrasa <alexandre@moz-code.org>
Tue, 17 Feb 2015 22:25:45 +0000 (23:25 +0100)
committerAlexandre Terrasa <alexandre@moz-code.org>
Wed, 25 Feb 2015 20:57:19 +0000 (21:57 +0100)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

src/doc/doc_base.nit
src/doc/doc_phases/doc_graphs.nit
src/doc/doc_phases/doc_hierarchies.nit

index e947ee2..64b2022 100644 (file)
@@ -68,7 +68,7 @@ end
 abstract class DocComposite
 
        # Parent element.
-       var parent: nullable DocComposite = null
+       var parent: nullable DocComposite = null is writable
 
        # Does `self` have a `parent`?
        fun is_root: Bool do return parent == null
@@ -85,6 +85,7 @@ abstract class DocComposite
        #
        # Shortcut for `children.add`.
        fun add_child(child: DocComposite) do
+               child.parent = self
                children.add child
        end
 end
index ba10850..66ef564 100644 (file)
@@ -41,6 +41,7 @@ class GraphPhase
                        if article == null then continue
                        # FIXME avoid diff
                        # page.root.add article
+                       article.parent = page.root.children.first.children[1]
                        page.root.children.first.children[1].children.insert(article, 0)
                end
        end
index 20b4cba..23da906 100644 (file)
@@ -47,6 +47,7 @@ redef class MModulePage
                var clients = self.clients.to_a
                v.name_sorter.sort(clients)
                section.add_child new HierarchyListArticle(mentity, "Clients", clients)
+               section.parent = root.children.first
                root.children.first.children.insert(section, 1)
        end
 end
@@ -66,6 +67,7 @@ redef class MClassPage
                var descendants = self.descendants.to_a
                v.name_sorter.sort(descendants)
                section.add_child new HierarchyListArticle(mentity, "Descendants", descendants)
+               section.parent = root.children.first
                root.children.first.children.insert(section, 1)
        end
 end