[valadoc] Api: Remove *Handler interfaces
- From: Florian Brosch <flobrosch src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [valadoc] Api: Remove *Handler interfaces
- Date: Wed, 21 Oct 2009 10:46:30 +0000 (UTC)
commit 060d4fcb9e2108ff71ded5ea572eaf70352e0d27
Author: Didier "Ptitjes <ptitjes free fr>
Date: Tue Oct 20 02:48:26 2009 +0200
Api: Remove *Handler interfaces
src/doclets/devhelp/doclet/doclet.vala | 282 ++++----------------
src/doclets/htm/doclet/doclet.vala | 219 ++++------------
src/doclets/htmlhelpers/doclet/doclet.vala | 26 +-
src/libvaladoc/Makefile.am | 18 +--
src/libvaladoc/api/class.vala | 7 +-
src/libvaladoc/api/classhandler.vala | 46 ----
src/libvaladoc/api/constant.vala | 8 +-
src/libvaladoc/api/constanthandler.vala | 31 ---
src/libvaladoc/api/constructionmethodhandler.vala | 32 ---
src/libvaladoc/api/delegate.vala | 11 +-
src/libvaladoc/api/delegatehandler.vala | 30 --
src/libvaladoc/api/enum.vala | 12 +-
src/libvaladoc/api/enumhandler.vala | 32 ---
src/libvaladoc/api/errordomain.vala | 11 +-
src/libvaladoc/api/errordomainhandler.vala | 31 ---
src/libvaladoc/api/exceptionlisthandler.vala | 41 ---
src/libvaladoc/api/field.vala | 8 +-
src/libvaladoc/api/fieldhandler.vala | 31 ---
src/libvaladoc/api/formalparameter.vala | 8 +-
src/libvaladoc/api/interface.vala | 3 +-
src/libvaladoc/api/interfacehandler.vala | 31 ---
src/libvaladoc/api/method.vala | 10 +-
src/libvaladoc/api/methodhandler.vala | 30 --
src/libvaladoc/api/namespace.vala | 12 +-
src/libvaladoc/api/namespacehandler.vala | 118 --------
src/libvaladoc/api/node.vala | 10 +
src/libvaladoc/api/nodebuilder.vala | 4 +-
src/libvaladoc/api/package.vala | 36 +++-
src/libvaladoc/api/parameterlisthandler.vala | 33 ---
src/libvaladoc/api/property.vala | 9 +-
src/libvaladoc/api/propertyhandler.vala | 45 ---
src/libvaladoc/api/returntypehandler.vala | 42 ---
src/libvaladoc/api/signal.vala | 8 +-
src/libvaladoc/api/signalhandler.vala | 30 --
src/libvaladoc/api/struct.vala | 3 +-
src/libvaladoc/api/structhandler.vala | 30 --
src/libvaladoc/api/symbol.vala | 14 +
.../api/templateparameterlisthandler.vala | 28 --
src/libvaladoc/api/tree.vala | 34 ++-
src/libvaladoc/api/typeparameter.vala | 8 +-
src/libvaladoc/api/typereference.vala | 3 +-
41 files changed, 245 insertions(+), 1180 deletions(-)
---
diff --git a/src/doclets/devhelp/doclet/doclet.vala b/src/doclets/devhelp/doclet/doclet.vala
index b0415ac..3a4714b 100755
--- a/src/doclets/devhelp/doclet/doclet.vala
+++ b/src/doclets/devhelp/doclet/doclet.vala
@@ -222,10 +222,11 @@ public class Valadoc.Devhelp.Doclet : Valadoc.Html.BasicDoclet {
write_wiki_pages ( tree, css_path_wiki, Path.build_filename(this.settings.path, this.settings.pkg_name, "content") );
- Gee.Collection<Package> packages = tree.get_package_list ();
- foreach ( Package pkg in packages ) {
- pkg.accept (this);
- }
+ tree.accept (this);
+ }
+
+ public override void visit_tree (Api.Tree tree) {
+ tree.accept_children (this);
}
public override void visit_package (Package package) {
@@ -257,278 +258,111 @@ public class Valadoc.Devhelp.Doclet : Valadoc.Html.BasicDoclet {
write_file_footer ();
file = null;
- package.visit_namespaces ( this );
+ package.accept_all_children (this);
this.devhelp.save_file ( devpath );
}
- public override void visit_namespace ( Namespace ns ) {
- if ( ns.name != null ) {
- string rpath = this.get_real_path ( ns );
- string path = this.get_path ( ns );
+ private void process_compound_node (Api.Node node, KeywordType type) {
+ string rpath = this.get_real_path (node);
+ string path = this.get_path (node);
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w" );
+ if (node.name != null) {
+ this.devhelp.add_chapter_start (node.name, path);
+
+ GLib.FileStream file = GLib.FileStream.open (rpath, "w");
writer = new MarkupWriter (file);
_renderer.set_writer (writer);
- write_file_header (this.css_path, ns.full_name());
- write_namespace_content (ns, ns);
+ write_file_header (css_path, node.full_name());
+ write_symbol_content (node);
write_file_footer ();
file = null;
-
- this.devhelp.add_keyword ( KeywordType.NAMESPACE, ns.name, path );
- this.devhelp.add_chapter_start ( ns.name, path );
}
- ns.visit_namespaces ( this );
- ns.visit_classes ( this );
- ns.visit_interfaces ( this );
- ns.visit_structs ( this );
- ns.visit_enums ( this );
- ns.visit_error_domains ( this );
- ns.visit_delegates ( this );
- ns.visit_methods ( this );
- ns.visit_fields ( this );
- ns.visit_constants ( this );
-
- if ( ns.name != null ) {
- this.devhelp.add_chapter_end ( );
+ node.accept_all_children (this);
+
+ if (node.name != null) {
+ this.devhelp.add_chapter_end ();
+ this.devhelp.add_keyword (type, node.name, path);
}
}
- public override void visit_interface ( Interface iface ) {
- string rpath = this.get_real_path ( iface );
- string path = this.get_path ( iface );
-
+ private void process_node (Api.Node node, KeywordType type) {
+ string rpath = this.get_real_path (node);
+ string path = this.get_path (node);
- this.devhelp.add_chapter_start ( iface.name, path );
-
- iface.visit_classes ( this );
- iface.visit_structs ( this );
- iface.visit_enums ( this );
- iface.visit_delegates ( this );
- iface.visit_methods ( this );
- iface.visit_signals ( this );
- iface.visit_properties ( this );
- iface.visit_fields ( this );
- iface.visit_constants ( this );
-
- this.devhelp.add_chapter_end ( );
-
- this.devhelp.add_keyword ( KeywordType.INTERFACE, iface.name, path );
-
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
+ GLib.FileStream file = GLib.FileStream.open (rpath, "w");
writer = new MarkupWriter (file);
_renderer.set_writer (writer);
- write_file_header (this.css_path, iface.full_name());
- write_symbol_content (iface);
+ write_file_header (css_path, node.full_name());
+ write_symbol_content (node);
write_file_footer ();
file = null;
- }
- public override void visit_class ( Class cl ) {
- string rpath = this.get_real_path ( cl );
- string path = this.get_path ( cl );
+ node.accept_all_children (this);
-
- this.devhelp.add_keyword ( KeywordType.CLASS, cl.name, path );
- this.devhelp.add_chapter_start ( cl.name, path );
-
- cl.visit_construction_methods ( this );
- cl.visit_classes ( this );
- cl.visit_structs ( this );
- cl.visit_enums ( this );
- cl.visit_delegates ( this );
- cl.visit_methods ( this );
- cl.visit_signals ( this );
- cl.visit_properties ( this );
- cl.visit_fields ( this );
- cl.visit_constants ( this );
-
- this.devhelp.add_chapter_end ( );
-
-
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- write_file_header (this.css_path, cl.full_name());
- write_symbol_content (cl);
- write_file_footer ();
- file = null;
+ this.devhelp.add_keyword (type, node.name, path);
+ this.devhelp.add_chapter (node.name, path);
}
- public override void visit_struct ( Struct stru ) {
- string rpath = this.get_real_path ( stru );
- string path = this.get_path ( stru );
-
-
- this.devhelp.add_keyword ( KeywordType.STRUCT, stru.name, path );
- this.devhelp.add_chapter_start ( stru.name, path );
-
- stru.visit_construction_methods ( this );
- stru.visit_methods ( this );
- stru.visit_fields ( this );
- stru.visit_constants ( this );
-
- this.devhelp.add_chapter_end ( );
-
-
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- write_file_header (this.css_path, stru.full_name());
- write_symbol_content (stru);
- write_file_footer ();
- file = null;
+ public override void visit_namespace (Namespace item) {
+ process_compound_node (item, KeywordType.NAMESPACE);
}
- public override void visit_error_domain ( ErrorDomain errdom ) {
- string rpath = this.get_real_path ( errdom );
- string path = this.get_path ( errdom );
-
- errdom.visit_methods ( this );
-
- this.devhelp.add_keyword ( KeywordType.ERRORDOMAIN, errdom.name, path );
- this.devhelp.add_chapter ( errdom.name, path );
-
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- write_file_header (this.css_path, errdom.full_name());
- write_symbol_content (errdom);
- write_file_footer ();
- file = null;
+ public override void visit_interface (Interface item) {
+ process_compound_node (item, KeywordType.INTERFACE);
}
- public override void visit_enum ( Enum en ) {
- string rpath = this.get_real_path ( en );
- string path = this.get_path ( en );
-
- en.visit_enum_values ( this );
- en.visit_methods ( this );
-
- this.devhelp.add_keyword ( KeywordType.ENUM, en.name, path );
- this.devhelp.add_chapter ( en.name, path );
-
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- write_file_header (this.css_path, en.full_name());
- write_symbol_content (en);
- write_file_footer ();
- file = null;
+ public override void visit_class (Class item) {
+ process_compound_node (item, KeywordType.CLASS);
}
- public override void visit_property ( Property prop ) {
- string rpath = this.get_real_path ( prop );
- string path = this.get_path ( prop );
-
- this.devhelp.add_keyword ( KeywordType.PROPERTY, prop.name, path );
- this.devhelp.add_chapter ( prop.name, path );
-
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- write_file_header (this.css_path, prop.full_name());
- write_symbol_content (prop);
- write_file_footer ();
- file = null;
+ public override void visit_struct (Struct item) {
+ process_compound_node (item, KeywordType.STRUCT);
}
- public override void visit_constant (Constant constant) {
- string rpath = this.get_real_path ( constant );
- string path = this.get_path ( constant );
-
- this.devhelp.add_keyword ( KeywordType.VARIABLE, constant.name, path );
- this.devhelp.add_chapter ( constant.name, path );
-
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- write_file_header (this.css_path, constant.full_name());
- write_symbol_content (constant);
- write_file_footer ();
- file = null;
+ public override void visit_error_domain (ErrorDomain item) {
+ process_node (item, KeywordType.ERRORDOMAIN);
}
- public override void visit_field (Field field) {
- string rpath = this.get_real_path ( field );
- string path = this.get_path ( field );
-
- this.devhelp.add_keyword ( KeywordType.VARIABLE, field.name, path );
- this.devhelp.add_chapter ( field.name, path );
-
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- write_file_header (this.css_path, field.full_name());
- write_symbol_content (field);
- write_file_footer ();
- file = null;
+ public override void visit_enum ( Enum item) {
+ process_node (item, KeywordType.ENUM);
}
- public override void visit_error_code ( ErrorCode errcode ) {
+ public override void visit_property (Property item) {
+ process_node (item, KeywordType.PROPERTY);
}
- public override void visit_enum_value ( Api.EnumValue enval ) {
+ public override void visit_constant (Constant item) {
+ process_node (item, KeywordType.VARIABLE);
}
- public override void visit_delegate ( Delegate del ) {
- string rpath = this.get_real_path ( del );
- string path = this.get_path ( del );
-
- this.devhelp.add_keyword ( KeywordType.DELEGATE, del.name, path );
- this.devhelp.add_chapter ( del.name, path );
-
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- write_file_header (this.css_path, del.full_name());
- write_symbol_content (del);
- write_file_footer ();
- file = null;
+ public override void visit_field (Field item) {
+ process_node (item, KeywordType.VARIABLE);
}
- public override void visit_signal ( Api.Signal sig ) {
- string rpath = this.get_real_path ( sig );
- string path = this.get_path ( sig );
-
- this.devhelp.add_keyword ( KeywordType.SIGNAL, sig.name, path );
- this.devhelp.add_chapter ( sig.name, path );
+ public override void visit_error_code (ErrorCode item) {
+ }
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- write_file_header (this.css_path, sig.full_name());
- write_symbol_content (sig);
- write_file_footer ();
- file = null;
+ public override void visit_enum_value (Api.EnumValue item) {
}
- public override void visit_method (Method m) {
- string rpath = this.get_real_path ( m );
- string path = this.get_path ( m );
+ public override void visit_delegate (Delegate item) {
+ process_node (item, KeywordType.DELEGATE);
+ }
- this.devhelp.add_keyword ( KeywordType.FUNCTION, m.name, path );
- this.devhelp.add_chapter ( m.name, path );
+ public override void visit_signal (Api.Signal item) {
+ process_node (item, KeywordType.SIGNAL);
+ }
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- write_file_header (this.css_path, m.full_name());
- write_symbol_content (m);
- write_file_footer ();
- file = null;
+ public override void visit_method (Method item) {
+ process_node (item, KeywordType.FUNCTION);
}
}
-
-
-
-
[ModuleInit]
public Type register_plugin ( ) {
Valadoc.Html.get_html_link_imp = Valadoc.Devhelp.get_html_link;
return typeof ( Valadoc.Devhelp.Doclet );
}
-
diff --git a/src/doclets/htm/doclet/doclet.vala b/src/doclets/htm/doclet/doclet.vala
index 6d7fbfc..d6e252c 100755
--- a/src/doclets/htm/doclet/doclet.vala
+++ b/src/doclets/htm/doclet/doclet.vala
@@ -130,10 +130,11 @@ public class Valadoc.HtmlDoclet : Valadoc.Html.BasicDoclet {
write_file_footer ();
file = null;
- Gee.Collection<Package> packages = tree.get_package_list ();
- foreach ( Package pkg in packages ) {
- pkg.accept (this);
- }
+ tree.accept (this);
+ }
+
+ public override void visit_tree (Api.Tree tree) {
+ tree.accept_children (this);
}
public override void visit_package (Package package) {
@@ -152,7 +153,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Html.BasicDoclet {
write_file_footer ();
file = null;
- package.visit_namespaces ( this );
+ package.accept_all_children (this);
}
public override void visit_namespace ( Namespace ns ) {
@@ -169,208 +170,90 @@ public class Valadoc.HtmlDoclet : Valadoc.Html.BasicDoclet {
file = null;
}
- // file:
- ns.visit_namespaces ( this );
- ns.visit_classes ( this );
- ns.visit_interfaces ( this );
- ns.visit_structs ( this );
- ns.visit_enums ( this );
- ns.visit_error_domains ( this );
- ns.visit_delegates ( this );
- ns.visit_methods ( this );
- ns.visit_fields ( this );
- ns.visit_constants ( this );
+ ns.accept_all_children (this);
}
- public override void visit_interface ( Interface iface ) {
- string rpath = this.get_real_path ( iface );
-
- iface.visit_classes ( this );
- iface.visit_structs ( this );
- iface.visit_enums ( this );
- iface.visit_delegates ( this );
- iface.visit_methods ( this );
- iface.visit_signals ( this );
- iface.visit_properties ( this );
- iface.visit_fields ( this );
- iface.visit_constants ( this );
+ private void process_node (Api.Node node) {
+ string rpath = this.get_real_path (node);
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
+ GLib.FileStream file = GLib.FileStream.open (rpath, "w");
writer = new MarkupWriter (file);
_renderer.set_writer (writer);
- write_file_header (this.css_path, iface.full_name());
- write_navi_symbol (iface);
- write_symbol_content (iface);
+ write_file_header (css_path, node.full_name());
+ if (is_internal_node (node)) {
+ write_navi_symbol (node);
+ } else {
+ write_navi_leaf_symbol (node);
+ }
+ write_symbol_content (node);
write_file_footer ();
file = null;
- }
- public override void visit_class ( Class cl ) {
- string rpath = this.get_real_path ( cl );
-
- cl.visit_construction_methods ( this );
- cl.visit_classes ( this );
- cl.visit_structs ( this );
- cl.visit_enums ( this );
- cl.visit_delegates ( this );
- cl.visit_methods ( this );
- cl.visit_signals ( this );
- cl.visit_properties ( this );
- cl.visit_fields ( this );
- cl.visit_constants ( this );
-
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- write_file_header (this.css_path, cl.full_name());
- write_navi_symbol (cl);
- write_symbol_content (cl);
- write_file_footer ();
- file = null;
+ node.accept_all_children (this);
}
- public override void visit_struct ( Struct stru ) {
- string rpath = this.get_real_path ( stru );
-
- stru.visit_construction_methods ( this );
- stru.visit_methods ( this );
- stru.visit_fields ( this );
- stru.visit_constants ( this );
-
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- write_file_header (this.css_path, stru.full_name());
- write_navi_symbol (stru);
- write_symbol_content (stru);
- write_file_footer ();
- file = null;
+ private bool is_internal_node (Api.Node node) {
+ return node is Package
+ || node is Namespace
+ || node is Interface
+ || node is Class
+ || node is Struct;
}
- public override void visit_error_domain ( ErrorDomain errdom ) {
- string rpath = this.get_real_path ( errdom );
-
- errdom.visit_methods ( this );
-
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- write_file_header (this.css_path, errdom.full_name());
- write_navi_symbol (errdom);
- write_symbol_content (errdom);
- write_file_footer ();
- file = null;
+ public override void visit_interface (Interface item) {
+ process_node (item);
}
- public override void visit_enum ( Enum en ) {
- string rpath = this.get_real_path ( en );
-
- en.visit_enum_values ( this );
- en.visit_methods ( this );
-
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- write_file_header (this.css_path, en.full_name());
- write_navi_symbol (en);
- write_symbol_content (en);
- write_file_footer ();
- file = null;
+ public override void visit_class (Class item) {
+ process_node (item);
}
- public override void visit_property ( Property prop ) {
- string rpath = this.get_real_path ( prop );
-
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- write_file_header (this.css_path, prop.full_name());
- write_navi_leaf_symbol (prop);
- write_symbol_content (prop);
- write_file_footer ();
- file = null;
+ public override void visit_struct (Struct item) {
+ process_node (item);
}
- public override void visit_constant (Constant constant) {
- string rpath = this.get_real_path ( constant );
-
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- write_file_header (this.css_path, constant.full_name());
- write_navi_leaf_symbol (constant);
- write_symbol_content (constant);
- write_file_footer ();
- file = null;
+ public override void visit_error_domain (ErrorDomain item) {
+ process_node (item);
}
- public override void visit_field (Field field) {
- string rpath = this.get_real_path ( field );
-
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- write_file_header (this.css_path, field.full_name());
- write_navi_leaf_symbol (field);
- write_symbol_content (field);
- write_file_footer ();
- file = null;
+ public override void visit_enum (Enum item) {
+ process_node (item);
}
- public override void visit_error_code ( ErrorCode errcode ) {
+ public override void visit_property (Property item) {
+ process_node (item);
}
- public override void visit_enum_value ( Api.EnumValue enval ) {
+ public override void visit_constant (Constant item) {
+ process_node (item);
}
- public override void visit_delegate ( Delegate del ) {
- string rpath = this.get_real_path ( del );
+ public override void visit_field (Field item) {
+ process_node (item);
+ }
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- write_file_header (this.css_path, del.full_name());
- write_navi_leaf_symbol (del);
- write_symbol_content (del);
- write_file_footer ();
- file = null;
+ public override void visit_error_code (ErrorCode item) {
}
- public override void visit_signal ( Api.Signal sig ) {
- string rpath = this.get_real_path ( sig );
+ public override void visit_enum_value (Api.EnumValue item) {
+ }
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- write_file_header (this.css_path, sig.full_name());
- write_navi_leaf_symbol (sig);
- write_symbol_content (sig);
- write_file_footer ();
- file = null;
+ public override void visit_delegate (Delegate item) {
+ process_node (item);
}
- public override void visit_method (Method m) {
- string rpath = this.get_real_path ( m );
+ public override void visit_signal (Api.Signal item) {
+ process_node (item);
+ }
- GLib.FileStream file = GLib.FileStream.open ( rpath, "w");
- writer = new MarkupWriter (file);
- _renderer.set_writer (writer);
- write_file_header (this.css_path, m.full_name());
- write_navi_leaf_symbol (m);
- write_symbol_content (m);
- write_file_footer ();
- file = null;
+ public override void visit_method (Method item) {
+ process_node (item);
}
}
-
-
-
-
[ModuleInit]
public Type register_plugin ( ) {
Valadoc.Html.get_html_link_imp = Valadoc.get_html_link;
return typeof ( Valadoc.HtmlDoclet );
}
-
diff --git a/src/doclets/htmlhelpers/doclet/doclet.vala b/src/doclets/htmlhelpers/doclet/doclet.vala
index cd3b479..31a1c85 100755
--- a/src/doclets/htmlhelpers/doclet/doclet.vala
+++ b/src/doclets/htmlhelpers/doclet/doclet.vala
@@ -154,12 +154,10 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
}
}
- protected void fetch_subnamespace_names (NamespaceHandler pos, Gee.ArrayList<Namespace> lst) {
- Gee.Collection<Namespace> nspaces = pos.get_namespace_list ();
-
- foreach (Namespace ns in nspaces) {
- lst.add (ns);
- this.fetch_subnamespace_names (ns, lst);
+ protected void fetch_subnamespace_names (Api.Node node, Gee.ArrayList<Namespace> namespaces) {
+ foreach (Api.Node child in node.get_children_by_type (Api.NodeType.NAMESPACE)) {
+ namespaces.add ((Namespace) child);
+ this.fetch_subnamespace_names (child, namespaces);
}
}
@@ -387,23 +385,23 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
writer.end_tag ("div");
}
- protected void write_child_namespaces (NamespaceHandler nh, Api.Node? parent) {
- Gee.ArrayList<Namespace> nsl = new Gee.ArrayList<Namespace> ();
- this.fetch_subnamespace_names (nh, nsl);
+ protected void write_child_namespaces (Api.Node node, Api.Node? parent) {
+ Gee.ArrayList<Namespace> namespaces = new Gee.ArrayList<Namespace> ();
+ this.fetch_subnamespace_names (node, namespaces);
- if (nsl.size == 0)
+ if (namespaces.size == 0)
return ;
- if (nsl.size == 1) {
- if (nsl.get(0).name == null)
+ if (namespaces.size == 1) {
+ if (namespaces.get(0).name == null)
return ;
}
- bool with_childs = (parent == null)? false : parent is Package;
+ bool with_childs = parent != null && parent is Package;
writer.start_tag ("h3", css_title).text ("Namespaces:").end_tag ("h3");
writer.start_tag ("ul", css_inline_navigation);
- foreach (Namespace child in nsl) {
+ foreach (Namespace child in namespaces) {
if (child.name != null) {
writer.start_tag ("li", css_namespace);
writer.link (get_link (child, parent), child.name);
diff --git a/src/libvaladoc/Makefile.am b/src/libvaladoc/Makefile.am
index ed4534f..2764948 100644
--- a/src/libvaladoc/Makefile.am
+++ b/src/libvaladoc/Makefile.am
@@ -35,47 +35,30 @@ libvaladoc_la_VALASOURCES = \
documentation/wikiscanner.vala \
api/array.vala \
api/class.vala \
- api/classhandler.vala \
api/constant.vala \
- api/constanthandler.vala \
- api/constructionmethodhandler.vala \
api/delegate.vala \
- api/delegatehandler.vala \
api/enum.vala \
- api/enumhandler.vala \
api/enumvalue.vala \
api/errorcode.vala \
api/errordomain.vala \
- api/errordomainhandler.vala \
- api/exceptionlisthandler.vala \
api/field.vala \
- api/fieldhandler.vala \
api/formalparameter.vala \
api/interface.vala \
- api/interfacehandler.vala \
api/item.vala \
api/member.vala \
api/method.vala \
- api/methodhandler.vala \
api/namespace.vala \
- api/namespacehandler.vala \
api/node.vala \
api/nodebuilder.vala \
api/package.vala \
- api/parameterlisthandler.vala \
api/pointer.vala \
api/property.vala \
api/propertyaccessor.vala \
- api/propertyhandler.vala \
- api/returntypehandler.vala \
api/signal.vala \
- api/signalhandler.vala \
api/signaturebuilder.vala \
api/struct.vala \
- api/structhandler.vala \
api/symbol.vala \
api/symbolaccessibility.vala \
- api/templateparameterlisthandler.vala \
api/tree.vala \
api/typeparameter.vala \
api/typereference.vala \
@@ -181,3 +164,4 @@ vapi_DATA = \
valadoc-1.0.deps \
$(NULL)
+
diff --git a/src/libvaladoc/api/class.vala b/src/libvaladoc/api/class.vala
index 9d5bd75..81e49da 100644
--- a/src/libvaladoc/api/class.vala
+++ b/src/libvaladoc/api/class.vala
@@ -20,7 +20,7 @@
using Gee;
using Valadoc.Content;
-public class Valadoc.Api.Class : TypeSymbol, ClassHandler, StructHandler, SignalHandler, MethodHandler, EnumHandler, PropertyHandler, ConstructionMethodHandler, FieldHandler, DelegateHandler, ConstantHandler, TemplateParameterListHandler {
+public class Valadoc.Api.Class : TypeSymbol {
private ArrayList<TypeReference> interfaces;
private Vala.Class vclass;
@@ -50,10 +50,6 @@ public class Valadoc.Api.Class : TypeSymbol, ClassHandler, StructHandler, Signal
return this.interfaces;
}
- internal bool is_vclass (Vala.Class vcl) {
- return this.vclass == vcl;
- }
-
public bool is_abstract {
get {
return this.vclass.is_abstract;
@@ -139,3 +135,4 @@ public class Valadoc.Api.Class : TypeSymbol, ClassHandler, StructHandler, Signal
return signature.get ();
}
}
+
diff --git a/src/libvaladoc/api/constant.vala b/src/libvaladoc/api/constant.vala
index dd48b35..6de083c 100644
--- a/src/libvaladoc/api/constant.vala
+++ b/src/libvaladoc/api/constant.vala
@@ -20,7 +20,7 @@
using Gee;
using Valadoc.Content;
-public class Valadoc.Api.Constant : Member, ReturnTypeHandler {
+public class Valadoc.Api.Constant : Member {
private Vala.Constant vconst;
public TypeReference? type_reference {
@@ -36,8 +36,7 @@ public class Valadoc.Api.Constant : Member, ReturnTypeHandler {
base (symbol, parent);
this.vconst = symbol;
- var vret = this.vconst.type_reference;
- this.set_ret_type (vret);
+ type_reference = new TypeReference (symbol.type_reference, this);
}
public string get_cname () {
@@ -45,7 +44,7 @@ public class Valadoc.Api.Constant : Member, ReturnTypeHandler {
}
protected override void resolve_type_references (Tree root) {
- this.set_return_type_references (root);
+ type_reference.resolve_type_references (root);
}
protected override Inline build_signature () {
@@ -63,3 +62,4 @@ public class Valadoc.Api.Constant : Member, ReturnTypeHandler {
visitor.visit_constant (this);
}
}
+
diff --git a/src/libvaladoc/api/delegate.vala b/src/libvaladoc/api/delegate.vala
index 36debeb..cf88e73 100644
--- a/src/libvaladoc/api/delegate.vala
+++ b/src/libvaladoc/api/delegate.vala
@@ -20,7 +20,7 @@
using Gee;
using Valadoc.Content;
-public class Valadoc.Api.Delegate : TypeSymbol, ParameterListHandler, ReturnTypeHandler, TemplateParameterListHandler, ExceptionHandler {
+public class Valadoc.Api.Delegate : TypeSymbol {
private Vala.Delegate vdelegate;
public Delegate (Vala.Delegate symbol, Node parent) {
@@ -28,8 +28,7 @@ public class Valadoc.Api.Delegate : TypeSymbol, ParameterListHandler, ReturnType
this.vdelegate = symbol;
- var ret = this.vdelegate.return_type;
- this.set_ret_type (ret);
+ type_reference = new TypeReference (symbol.return_type, this);
}
public string? get_cname () {
@@ -54,10 +53,7 @@ public class Valadoc.Api.Delegate : TypeSymbol, ParameterListHandler, ReturnType
}
protected override void resolve_type_references (Tree root) {
- this.set_return_type_references (root);
-
- var vexceptionlst = this.vdelegate.get_error_types ();
- this.add_exception_list (root, vexceptionlst);
+ type_reference.resolve_type_references (root);
base.resolve_type_references (root);
}
@@ -116,3 +112,4 @@ public class Valadoc.Api.Delegate : TypeSymbol, ParameterListHandler, ReturnType
return signature.get ();
}
}
+
diff --git a/src/libvaladoc/api/enum.vala b/src/libvaladoc/api/enum.vala
index 4beade8..3f5bae7 100644
--- a/src/libvaladoc/api/enum.vala
+++ b/src/libvaladoc/api/enum.vala
@@ -20,7 +20,7 @@
using Gee;
using Valadoc.Content;
-public class Valadoc.Api.Enum : TypeSymbol, MethodHandler {
+public class Valadoc.Api.Enum : TypeSymbol {
public Enum (Vala.Enum symbol, Node parent) {
base (symbol, parent);
this.venum = symbol;
@@ -30,15 +30,6 @@ public class Valadoc.Api.Enum : TypeSymbol, MethodHandler {
return this.venum.get_cname();
}
- // rename: get_enum_value_list
- public Collection<EnumValue> get_enum_values () {
- return get_children_by_type (NodeType.ENUM_VALUE);
- }
-
- public void visit_enum_values (Visitor visitor) {
- accept_children_by_type (NodeType.ENUM_VALUE, visitor);
- }
-
public override NodeType node_type { get { return NodeType.ENUM; } }
public override void accept (Visitor visitor) {
@@ -55,3 +46,4 @@ public class Valadoc.Api.Enum : TypeSymbol, MethodHandler {
.get ();
}
}
+
diff --git a/src/libvaladoc/api/errordomain.vala b/src/libvaladoc/api/errordomain.vala
index 3019bd1..d8c5e76 100644
--- a/src/libvaladoc/api/errordomain.vala
+++ b/src/libvaladoc/api/errordomain.vala
@@ -21,7 +21,7 @@ using Gee;
using Valadoc.Content;
-public class Valadoc.Api.ErrorDomain : TypeSymbol, MethodHandler {
+public class Valadoc.Api.ErrorDomain : TypeSymbol {
private Vala.ErrorDomain verrdom;
public ErrorDomain (Vala.ErrorDomain symbol, Node parent) {
@@ -33,14 +33,6 @@ public class Valadoc.Api.ErrorDomain : TypeSymbol, MethodHandler {
return this.verrdom.get_cname();
}
- public void visit_error_codes (Visitor visitor) {
- accept_children_by_type (NodeType.ERROR_CODE, visitor);
- }
-
- public Collection<ErrorCode> get_error_code_list () {
- return get_children_by_type (NodeType.ERROR_CODE);
- }
-
public override NodeType node_type { get { return NodeType.ERROR_DOMAIN; } }
public override void accept (Visitor visitor) {
@@ -55,3 +47,4 @@ public class Valadoc.Api.ErrorDomain : TypeSymbol, MethodHandler {
.get ();
}
}
+
diff --git a/src/libvaladoc/api/field.vala b/src/libvaladoc/api/field.vala
index a3272a3..b640666 100644
--- a/src/libvaladoc/api/field.vala
+++ b/src/libvaladoc/api/field.vala
@@ -20,15 +20,14 @@
using Gee;
using Valadoc.Content;
-public class Valadoc.Api.Field : Member, ReturnTypeHandler {
+public class Valadoc.Api.Field : Member {
private Vala.Field vfield;
public Field (Vala.Field symbol, Node parent) {
base (symbol, parent);
this.vfield = symbol;
- var vret = this.vfield.field_type;
- this.set_ret_type (vret);
+ type_reference = new TypeReference (symbol.field_type, this);
}
public string? get_cname () {
@@ -57,7 +56,7 @@ public class Valadoc.Api.Field : Member, ReturnTypeHandler {
}
protected override void resolve_type_references (Tree root) {
- this.set_return_type_references (root);
+ type_reference.resolve_type_references (root);
base.resolve_type_references (root);
}
@@ -84,3 +83,4 @@ public class Valadoc.Api.Field : Member, ReturnTypeHandler {
visitor.visit_field (this);
}
}
+
diff --git a/src/libvaladoc/api/formalparameter.vala b/src/libvaladoc/api/formalparameter.vala
index 478fc7c..840b745 100644
--- a/src/libvaladoc/api/formalparameter.vala
+++ b/src/libvaladoc/api/formalparameter.vala
@@ -20,15 +20,14 @@
using Gee;
using Valadoc.Content;
-public class Valadoc.Api.FormalParameter : Symbol, ReturnTypeHandler {
+public class Valadoc.Api.FormalParameter : Symbol {
private Vala.FormalParameter vformalparam;
public FormalParameter (Vala.FormalParameter symbol, Node parent) {
base (symbol, parent);
this.vformalparam = symbol;
- var vformparam = this.vformalparam.parameter_type;
- this.set_ret_type (vformparam);
+ type_reference = new TypeReference (symbol.parameter_type, this);
}
public bool is_out {
@@ -71,7 +70,7 @@ public class Valadoc.Api.FormalParameter : Symbol, ReturnTypeHandler {
return;
}
- this.set_return_type_references (root);
+ type_reference.resolve_type_references (root);
base.resolve_type_references (root);
}
@@ -100,3 +99,4 @@ public class Valadoc.Api.FormalParameter : Symbol, ReturnTypeHandler {
return signature.get ();
}
}
+
diff --git a/src/libvaladoc/api/interface.vala b/src/libvaladoc/api/interface.vala
index 17030f0..de71803 100644
--- a/src/libvaladoc/api/interface.vala
+++ b/src/libvaladoc/api/interface.vala
@@ -20,7 +20,7 @@
using Gee;
using Valadoc.Content;
-public class Valadoc.Api.Interface : TypeSymbol, SignalHandler, PropertyHandler, FieldHandler, ConstantHandler, TemplateParameterListHandler, MethodHandler, DelegateHandler, EnumHandler, StructHandler, ClassHandler {
+public class Valadoc.Api.Interface : TypeSymbol {
public Interface (Vala.Interface symbol, Node parent) {
base (symbol, parent);
this.vinterface = symbol;
@@ -119,3 +119,4 @@ public class Valadoc.Api.Interface : TypeSymbol, SignalHandler, PropertyHandler,
return signature.get ();
}
}
+
diff --git a/src/libvaladoc/api/method.vala b/src/libvaladoc/api/method.vala
index 3e02aeb..93f9a83 100644
--- a/src/libvaladoc/api/method.vala
+++ b/src/libvaladoc/api/method.vala
@@ -20,15 +20,14 @@
using Gee;
using Valadoc.Content;
-public class Valadoc.Api.Method : Member, ParameterListHandler, ExceptionHandler, TemplateParameterListHandler, ReturnTypeHandler {
+public class Valadoc.Api.Method : Member {
private Vala.Method vmethod;
public Method (Vala.Method symbol, Node parent) {
base (symbol, parent);
this.vmethod = symbol;
- var vret = this.vmethod.return_type;
- this.set_ret_type (vret);
+ type_reference = new TypeReference (symbol.return_type, this);
}
public string? get_cname () {
@@ -119,10 +118,7 @@ public class Valadoc.Api.Method : Member, ParameterListHandler, ExceptionHandler
this.base_method = (Method?) root.search_vala_symbol (vm);
}
- var vexceptionlst = this.vmethod.get_error_types ();
- this.add_exception_list (root, vexceptionlst);
-
- this.set_return_type_references (root);
+ type_reference.resolve_type_references (root);
base.resolve_type_references (root);
}
diff --git a/src/libvaladoc/api/namespace.vala b/src/libvaladoc/api/namespace.vala
index 1253e10..15ed345 100644
--- a/src/libvaladoc/api/namespace.vala
+++ b/src/libvaladoc/api/namespace.vala
@@ -20,13 +20,10 @@
using Gee;
using Valadoc.Content;
-public class Valadoc.Api.Namespace : Symbol, MethodHandler, FieldHandler, NamespaceHandler, ErrorDomainHandler,
- EnumHandler, ClassHandler, StructHandler, InterfaceHandler,
- DelegateHandler, ConstantHandler
-{
+public class Valadoc.Api.Namespace : Symbol {
private Vala.Comment source_comment;
- public Namespace (Vala.Namespace symbol, NamespaceHandler parent) {
+ public Namespace (Vala.Namespace symbol, Api.Node parent) {
base (symbol, parent);
this.vnspace = symbol;
@@ -67,8 +64,5 @@ public class Valadoc.Api.Namespace : Symbol, MethodHandler, FieldHandler, Namesp
private get;
set;
}
-
- internal bool is_vnspace (Vala.Namespace vns) {
- return this.vnspace == vns;
- }
}
+
diff --git a/src/libvaladoc/api/node.vala b/src/libvaladoc/api/node.vala
index 99efbf8..b1c8752 100644
--- a/src/libvaladoc/api/node.vala
+++ b/src/libvaladoc/api/node.vala
@@ -154,6 +154,16 @@ public abstract class Valadoc.Api.Node : Item, Visitable, Documentation {
}
}
+ public void accept_all_children (Visitor visitor) {
+ foreach (Gee.List<Node> children in per_type_children.values) {
+ foreach (Node node in children) {
+ if (node.do_document) {
+ node.accept (visitor);
+ }
+ }
+ }
+ }
+
public Node? find_by_name (string name) {
return per_name_children.get (name);
}
diff --git a/src/libvaladoc/api/nodebuilder.vala b/src/libvaladoc/api/nodebuilder.vala
index 7b79fd0..5662a5b 100644
--- a/src/libvaladoc/api/nodebuilder.vala
+++ b/src/libvaladoc/api/nodebuilder.vala
@@ -48,8 +48,7 @@ internal class Valadoc.Api.NodeBuilder : Vala.CodeVisitor {
Vala.SourceFile source_file = element.source_reference.file;
Package package = find_package_for (source_file);
- Namespace ns = package.get_namespace (element);
- return ns;
+ return package.get_namespace (root, element);
}
private Package? find_package_for (Vala.SourceFile source_file) {
@@ -224,3 +223,4 @@ internal class Valadoc.Api.NodeBuilder : Vala.CodeVisitor {
}
}
+
diff --git a/src/libvaladoc/api/package.vala b/src/libvaladoc/api/package.vala
index f9f9c2b..a7a780c 100644
--- a/src/libvaladoc/api/package.vala
+++ b/src/libvaladoc/api/package.vala
@@ -20,9 +20,7 @@
using Gee;
using Valadoc.Content;
-
-
-public class Valadoc.Api.Package : Node, NamespaceHandler {
+public class Valadoc.Api.Package : Node {
private ArrayList<Vala.SourceFile> vfiles = new ArrayList<Vala.SourceFile> ();
internal void add_file (Vala.SourceFile vfile) {
@@ -88,7 +86,6 @@ public class Valadoc.Api.Package : Node, NamespaceHandler {
}
}
- // TODO Remove
internal bool is_vpackage (Vala.SourceFile vfile) {
return this.vfiles.contains (vfile);
}
@@ -113,4 +110,35 @@ public class Valadoc.Api.Package : Node, NamespaceHandler {
.append (name)
.get ();
}
+
+ protected Namespace get_namespace (Tree root, Vala.Symbol symbol) {
+ Vala.Symbol namespace_symbol = symbol;
+ while (!(namespace_symbol is Vala.Namespace)) {
+ namespace_symbol = namespace_symbol.parent_symbol;
+ }
+
+ // Try to find it first
+ var ns = (Namespace) root.search_vala_symbol_in (namespace_symbol, this);
+ if (ns != null) {
+ return ns;
+ }
+
+ // Find parent namespace and use it as parent if existing
+ var parent_namespace_symbol = namespace_symbol.parent_symbol;
+
+ if (parent_namespace_symbol != null) {
+ 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);
+ return new_namespace;
+ }
+ }
+
+ // Else take this package as parent
+ var new_namespace = new Namespace ((Vala.Namespace) namespace_symbol, this);
+ add_child (new_namespace);
+ return new_namespace;
+ }
}
+
diff --git a/src/libvaladoc/api/property.vala b/src/libvaladoc/api/property.vala
index f42a8fe..68af7df 100644
--- a/src/libvaladoc/api/property.vala
+++ b/src/libvaladoc/api/property.vala
@@ -20,7 +20,7 @@
using Gee;
using Valadoc.Content;
-public class Valadoc.Api.Property : Member, ReturnTypeHandler {
+public class Valadoc.Api.Property : Member {
private Vala.Property vproperty;
public Property (Vala.Property symbol, Node parent) {
@@ -28,8 +28,7 @@ public class Valadoc.Api.Property : Member, ReturnTypeHandler {
this.vproperty = symbol;
- var ret = this.vproperty.property_type;
- this.set_ret_type (ret);
+ type_reference = new TypeReference (symbol.property_type, this);
if (this.vproperty.get_accessor != null) {
this.getter = new PropertyAccessor (this.vproperty.get_accessor, this);
@@ -103,7 +102,8 @@ public class Valadoc.Api.Property : Member, ReturnTypeHandler {
if (vp != null) {
this.base_property = (Property?) root.search_vala_symbol (vp);
}
- this.set_return_type_references (root);
+
+ type_reference.resolve_type_references (root);
}
protected override Inline build_signature () {
@@ -141,3 +141,4 @@ public class Valadoc.Api.Property : Member, ReturnTypeHandler {
visitor.visit_property (this);
}
}
+
diff --git a/src/libvaladoc/api/signal.vala b/src/libvaladoc/api/signal.vala
index 7fdf206..b8161a9 100644
--- a/src/libvaladoc/api/signal.vala
+++ b/src/libvaladoc/api/signal.vala
@@ -20,7 +20,7 @@
using Gee;
using Valadoc.Content;
-public class Valadoc.Api.Signal : Member, ParameterListHandler, ReturnTypeHandler {
+public class Valadoc.Api.Signal : Member {
private Vala.Signal vsignal;
public Signal (Vala.Signal symbol, Node parent) {
@@ -28,8 +28,7 @@ public class Valadoc.Api.Signal : Member, ParameterListHandler, ReturnTypeHandle
this.vsignal = symbol;
- var ret = this.vsignal.return_type;
- this.set_ret_type (ret);
+ type_reference = new TypeReference (symbol.return_type, this);
}
public string? get_cname () {
@@ -42,7 +41,7 @@ public class Valadoc.Api.Signal : Member, ParameterListHandler, ReturnTypeHandle
}
protected override void resolve_type_references (Tree root) {
- this.set_return_type_references (root);
+ type_reference.resolve_type_references (root);
base.resolve_type_references (root);
}
@@ -85,3 +84,4 @@ public class Valadoc.Api.Signal : Member, ParameterListHandler, ReturnTypeHandle
visitor.visit_signal (this);
}
}
+
diff --git a/src/libvaladoc/api/struct.vala b/src/libvaladoc/api/struct.vala
index 21d74dd..de40591 100644
--- a/src/libvaladoc/api/struct.vala
+++ b/src/libvaladoc/api/struct.vala
@@ -20,7 +20,7 @@
using Gee;
using Valadoc.Content;
-public class Valadoc.Api.Struct : TypeSymbol, MethodHandler, ConstructionMethodHandler, FieldHandler, ConstantHandler, TemplateParameterListHandler {
+public class Valadoc.Api.Struct : TypeSymbol {
private Vala.Struct vstruct;
public Struct (Vala.Struct symbol, Node parent) {
@@ -88,3 +88,4 @@ public class Valadoc.Api.Struct : TypeSymbol, MethodHandler, ConstructionMethodH
return signature.get ();
}
}
+
diff --git a/src/libvaladoc/api/symbol.vala b/src/libvaladoc/api/symbol.vala
index 4727963..011e625 100644
--- a/src/libvaladoc/api/symbol.vala
+++ b/src/libvaladoc/api/symbol.vala
@@ -103,4 +103,18 @@ public abstract class Valadoc.Api.Symbol : Node, SymbolAccessibility {
return "private";
}
}
+
+ protected override void resolve_type_references (Tree root) {
+ base.resolve_type_references (root);
+
+ foreach (Vala.DataType type in symbol.get_error_types ()) {
+ var error_type = type as Vala.ErrorType;
+ if (error_type.error_domain == null) {
+ add_child (glib_error);
+ } else {
+ add_child (root.search_vala_symbol (error_type.error_domain));
+ }
+ }
+ }
}
+
diff --git a/src/libvaladoc/api/tree.vala b/src/libvaladoc/api/tree.vala
index 41b954e..bc4ec7e 100644
--- a/src/libvaladoc/api/tree.vala
+++ b/src/libvaladoc/api/tree.vala
@@ -56,6 +56,12 @@ public class Valadoc.Api.Tree {
visitor.visit_tree (this);
}
+ public void accept_children (Visitor visitor) {
+ foreach (Node node in packages) {
+ node.accept (visitor);
+ }
+ }
+
private Node? search_relative_to (Node element, string[] path) {
Api.Node? node = element;
foreach (string name in path) {
@@ -153,11 +159,11 @@ public class Valadoc.Api.Tree {
}
/* default packages */
- if (!this.add_package ("glib-2.0")) { //
+ if (!this.add_package ("glib-2.0")) {
Vala.Report.error (null, "glib-2.0 not found in specified Vala API directories");
}
- if (!this.add_package ("gobject-2.0")) { //
+ if (!this.add_package ("gobject-2.0")) {
Vala.Report.error (null, "gobject-2.0 not found in specified Vala API directories");
}
}
@@ -329,13 +335,15 @@ public class Valadoc.Api.Tree {
}
}
- internal Node? search_vala_symbol (Vala.Symbol? vnode) {
- if (vnode == null) {
- return null;
- }
+ internal Symbol? search_vala_symbol (Vala.Symbol symbol) {
+ Vala.SourceFile source_file = symbol.source_reference.file;
+ Package package = this.find_file (source_file);
+ return search_vala_symbol_in (symbol, package);
+ }
+ internal Symbol? search_vala_symbol_in (Vala.Symbol symbol, Package package) {
ArrayList<Vala.Symbol> params = new ArrayList<Vala.Symbol> ();
- for (Vala.Symbol iter = vnode; iter != null; iter = iter.parent_symbol) {
+ for (Vala.Symbol iter = symbol; iter != null; iter = iter.parent_symbol) {
if (iter is Vala.DataType) {
params.insert (0, ((Vala.DataType)iter).data_type);
} else {
@@ -353,17 +361,14 @@ public class Valadoc.Api.Tree {
}
}
- Vala.SourceFile vfile = vnode.source_reference.file;
- Package file = this.find_file(vfile);
-
- Api.Node? node = file;
- foreach (Vala.Symbol symbol in params) {
- node = node.find_by_symbol (symbol);
+ Api.Node? node = package;
+ foreach (Vala.Symbol a_symbol in params) {
+ node = node.find_by_symbol (a_symbol);
if (node == null) {
return null;
}
}
- return node;
+ return (Symbol) node;
}
private Package? get_external_package_by_name (string name) {
@@ -375,3 +380,4 @@ public class Valadoc.Api.Tree {
return null;
}
}
+
diff --git a/src/libvaladoc/api/typeparameter.vala b/src/libvaladoc/api/typeparameter.vala
index 450b1e0..88a1946 100644
--- a/src/libvaladoc/api/typeparameter.vala
+++ b/src/libvaladoc/api/typeparameter.vala
@@ -20,17 +20,12 @@
using Gee;
using Valadoc.Content;
-public class Valadoc.Api.TypeParameter : Symbol, ReturnTypeHandler {
+public class Valadoc.Api.TypeParameter : Symbol {
public TypeParameter (Vala.TypeParameter symbol, Node parent) {
base (symbol, parent);
}
- public TypeReference? type_reference {
- protected set;
- get;
- }
-
protected override Inline build_signature () {
return new SignatureBuilder ()
.append (name)
@@ -43,3 +38,4 @@ public class Valadoc.Api.TypeParameter : Symbol, ReturnTypeHandler {
visitor.visit_type_parameter (this);
}
}
+
diff --git a/src/libvaladoc/api/typereference.vala b/src/libvaladoc/api/typereference.vala
index fad2072..610d6b6 100644
--- a/src/libvaladoc/api/typereference.vala
+++ b/src/libvaladoc/api/typereference.vala
@@ -194,7 +194,7 @@ public class Valadoc.Api.TypeReference : Item {
}
} else if (vtyperef is Vala.DelegateType) {
this.data_type = root.search_vala_symbol (((Vala.DelegateType) vtyperef).delegate_symbol);
- } else {
+ } else if (vtyperef.data_type != null) {
this.data_type = root.search_vala_symbol (vtyperef.data_type);
}
@@ -250,3 +250,4 @@ public class Valadoc.Api.TypeReference : Item {
return signature.get ();
}
}
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]