From: Didier "Ptitjes Date: Tue, 20 Oct 2009 01:13:29 +0000 (+0200) Subject: Fix namespace resolution X-Git-Tag: 0.37.1~3^2~542 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4584f113c5c3c480fcd15507ac474a16f0412aa2;p=thirdparty%2Fvala.git Fix namespace resolution --- diff --git a/src/doclets/htm/doclet/doclet.vala b/src/doclets/htm/doclet/doclet.vala index d6e252c9b..de41e1dae 100755 --- a/src/doclets/htm/doclet/doclet.vala +++ b/src/doclets/htm/doclet/doclet.vala @@ -148,7 +148,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Html.BasicDoclet { writer = new MarkupWriter (file); _renderer.set_writer (writer); write_file_header (this.css_path, pkg_name); - write_navi_package (package, package); + write_navi_package (package); write_package_content (package, package); write_file_footer (); file = null; diff --git a/src/doclets/htmlhelpers/doclet/doclet.vala b/src/doclets/htmlhelpers/doclet/doclet.vala index 097aa9d26..98f29cbb6 100755 --- a/src/doclets/htmlhelpers/doclet/doclet.vala +++ b/src/doclets/htmlhelpers/doclet/doclet.vala @@ -50,8 +50,7 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet { if (full_name == true && element is Namespace) { string tmp = element.full_name(); name = (tmp == null)? "Global Namespace" : tmp; - } - else { + } else { string tmp = element.name; name = (tmp == null)? "Global Namespace" : tmp; } @@ -94,7 +93,6 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet { } protected void write_navi_top_entry (Api.Node element, Api.Node? parent) { - string name = (element.name == null)? "Global Namespace" : element.name; string style = get_html_css_class (element); writer.start_tag ("ul", css_navi); @@ -144,35 +142,39 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet { } } - protected void write_navi_package (Package efile, Api.Node? pos) { + protected void write_navi_package (Package package) { Gee.ArrayList ns_list = new Gee.ArrayList (); - this.fetch_subnamespace_names (efile, ns_list); - + this.fetch_subnamespace_names (package, ns_list); writer.start_tag ("div", css_style_navigation); - - - if (pos == null) - this.write_top_elements (efile, null); - else if (pos == efile) - this.write_top_elements (efile, efile); - else - this.write_top_elements ((Api.Node)pos.parent.parent, pos); - + write_top_elements (package, package); writer.start_tag ("ul", css_navi); - Namespace globals = null; foreach (Namespace ns in ns_list) { - if (ns.name == null) + if (ns.name == null) { globals = ns; - else - this.write_navi_entry (ns, pos, css_namespace, true, true); + } else { + this.write_navi_entry (ns, package, css_namespace, true, true); + } } if (globals != null) { - write_navi_children (globals, Api.NodeType.NAMESPACE, pos); + write_navi_children (globals, Api.NodeType.ERROR_CODE, package); + write_navi_children (globals, Api.NodeType.ENUM_VALUE, package); + write_navi_children (globals, Api.NodeType.ENUM, package); + write_navi_children (globals, Api.NodeType.INTERFACE, package); + write_navi_children (globals, Api.NodeType.CLASS, package); + write_navi_children (globals, Api.NodeType.STRUCT, package); + write_navi_children (globals, Api.NodeType.CREATION_METHOD, package); + write_navi_children (globals, Api.NodeType.STATIC_METHOD, package); + write_navi_children (globals, Api.NodeType.CONSTANT, package); + write_navi_children (globals, Api.NodeType.PROPERTY, package); + write_navi_children (globals, Api.NodeType.DELEGATE, package); + write_navi_children (globals, Api.NodeType.METHOD, package); + write_navi_children (globals, Api.NodeType.SIGNAL, package); + write_navi_children (globals, Api.NodeType.FIELD, package); } writer.end_tag ("ul"); diff --git a/src/libvaladoc/api/package.vala b/src/libvaladoc/api/package.vala index f86efab4d..dce75e5ca 100644 --- a/src/libvaladoc/api/package.vala +++ b/src/libvaladoc/api/package.vala @@ -126,7 +126,7 @@ public class Valadoc.Api.Package : Node { ns = (Namespace) get_namespace (root, parent_namespace_symbol); if (ns != null) { var new_namespace = new Namespace ((Vala.Namespace) namespace_symbol, ns); - add_child (new_namespace); + ns.add_child (new_namespace); return new_namespace; } } diff --git a/src/libvaladoc/api/tree.vala b/src/libvaladoc/api/tree.vala index e80829e8f..c545a911e 100644 --- a/src/libvaladoc/api/tree.vala +++ b/src/libvaladoc/api/tree.vala @@ -355,12 +355,6 @@ public class Valadoc.Api.Tree { return null; } - if (params.size >= 2) { - if (params.get(1) is Vala.Namespace) { - params.remove_at (0); - } - } - Api.Node? node = package; foreach (Vala.Symbol a_symbol in params) { node = node.find_by_symbol (a_symbol);