]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Api: Externalize nodes creation
authorDidier 'Ptitjes <ptitjes@free.fr>
Wed, 14 Oct 2009 12:27:31 +0000 (14:27 +0200)
committerDidier 'Ptitjes <ptitjes@free.fr>
Wed, 14 Oct 2009 14:33:23 +0000 (16:33 +0200)
32 files changed:
src/libvaladoc/Makefile.am
src/libvaladoc/apitree/apinodebuilder.vala [new file with mode: 0644]
src/libvaladoc/apitree/apitree.vala
src/libvaladoc/apitree/class.vala
src/libvaladoc/apitree/classhandler.vala
src/libvaladoc/apitree/constant.vala
src/libvaladoc/apitree/constanthandler.vala
src/libvaladoc/apitree/constructionmethodhandler.vala
src/libvaladoc/apitree/delegate.vala
src/libvaladoc/apitree/delegatehandler.vala
src/libvaladoc/apitree/enum.vala
src/libvaladoc/apitree/enumvalue.vala
src/libvaladoc/apitree/errorcode.vala
src/libvaladoc/apitree/errordomain.vala
src/libvaladoc/apitree/errordomainhandler.vala
src/libvaladoc/apitree/field.vala
src/libvaladoc/apitree/fieldhandler.vala
src/libvaladoc/apitree/formalparameter.vala
src/libvaladoc/apitree/interface.vala
src/libvaladoc/apitree/interfacehandler.vala
src/libvaladoc/apitree/method.vala
src/libvaladoc/apitree/methodhandler.vala
src/libvaladoc/apitree/package.vala
src/libvaladoc/apitree/parameterlisthandler.vala
src/libvaladoc/apitree/property.vala
src/libvaladoc/apitree/propertyhandler.vala
src/libvaladoc/apitree/signal.vala
src/libvaladoc/apitree/signalhandler.vala
src/libvaladoc/apitree/struct.vala
src/libvaladoc/apitree/structhandler.vala
src/libvaladoc/apitree/templateparameterlisthandler.vala
src/libvaladoc/apitree/typeparameter.vala

index 151fe5a492dedbec3939287b8bb4531c7854ca26..58471d87d8b865d5c12f010a56f9accc0b0dc349 100644 (file)
@@ -36,6 +36,7 @@ libvaladoc_la_VALASOURCES = \
        apitree/apiitem.vala \
        apitree/apimembernode.vala \
        apitree/apinode.vala \
+       apitree/apinodebuilder.vala \
        apitree/apisymbolnode.vala \
        apitree/apitree.vala \
        apitree/apitypesymbolnode.vala \
diff --git a/src/libvaladoc/apitree/apinodebuilder.vala b/src/libvaladoc/apitree/apinodebuilder.vala
new file mode 100644 (file)
index 0000000..5355fa1
--- /dev/null
@@ -0,0 +1,216 @@
+/* apinodebuilder.vala
+ * 
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008-2009 Florian Brosch, Didier Villevalois
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Author:
+ *     Didier 'Ptitjes Villevalois <ptitjes@free.fr>
+ */
+
+using Vala;
+using Gee;
+
+internal class Valadoc.Api.NodeBuilder : CodeVisitor {
+       private Settings settings;
+       private Tree root;
+       private Gee.Collection<Package> packages;
+       private Node current_node;
+
+       internal NodeBuilder (Settings settings, Tree root) {
+               this.settings = settings;
+               this.root = root;
+               packages = root.get_package_list ();
+               current_node = null;
+       }
+
+       private void process_children (Node node, Vala.Symbol element) {
+               Node old_node = current_node;
+               current_node = node;
+               element.accept_children (this);
+               current_node = old_node;
+       }
+
+       private Node get_parent_node_for (Vala.Symbol element) {
+               if (current_node != null) {
+                       return current_node;
+               }
+
+               Vala.SourceFile source_file = element.source_reference.file;
+               Package package = find_package_for (source_file);
+               Namespace ns = package.get_namespace (element);
+               return ns;
+       }
+
+       private Package? find_package_for (Vala.SourceFile source_file) {
+               foreach (Package package in packages) {
+                       if (package.is_package_for_file (source_file))
+                               return package;
+               }
+               return null;
+       }
+
+       public override void visit_namespace (Vala.Namespace element) {
+               element.accept_children (this);
+       }
+
+       public override void visit_class (Vala.Class element) {
+               Node parent = get_parent_node_for (element);
+
+               SymbolNode node = new Class (settings, element, parent, root);
+               parent.add_child (node);
+
+               process_children (node, element);
+       }
+
+       public override void visit_interface (Vala.Interface element) {
+               Node parent = get_parent_node_for (element);
+
+               SymbolNode node = new Interface (settings, element, parent, root);
+               parent.add_child (node);
+
+               process_children (node, element);
+       }
+
+       public override void visit_struct (Vala.Struct element) {
+               Node parent = get_parent_node_for (element);
+
+               SymbolNode node = new Struct (settings, element, parent, root);
+               parent.add_child (node);
+
+               process_children (node, element);
+       }
+
+       public override void visit_field (Vala.Field element) {
+               Node parent = get_parent_node_for (element);
+
+               SymbolNode node = new Field (settings, element, parent, root);
+               parent.add_child (node);
+
+               // Process field type
+
+               process_children (node, element);
+       }
+
+       public override void visit_property (Vala.Property element) {
+               Node parent = get_parent_node_for (element);
+
+               SymbolNode node = new Property (settings, element, parent, root);
+               parent.add_child (node);
+
+               // Process property type
+
+               process_children (node, element);
+       }
+
+       public override void visit_method (Vala.Method element) {
+               Node parent = get_parent_node_for (element);
+
+               SymbolNode node = new Method (settings, element, parent, root);
+               parent.add_child (node);
+
+               // Process error types
+               // Process return type
+
+               process_children (node, element);
+       }
+
+       public override void visit_signal (Vala.Signal element) {
+               Node parent = get_parent_node_for (element);
+
+               SymbolNode node = new Signal (settings, element, parent, root);
+               parent.add_child (node);
+
+               // Process return type
+
+               process_children (node, element);
+       }
+
+       public override void visit_delegate (Vala.Delegate element) {
+               Node parent = get_parent_node_for (element);
+
+               SymbolNode node = new Delegate (settings, element, parent, root);
+               parent.add_child (node);
+
+               // Process error types
+               // Process return type
+
+               process_children (node, element);
+       }
+
+       public override void visit_enum (Vala.Enum element) {
+               Node parent = get_parent_node_for (element);
+
+               SymbolNode node = new Enum (settings, element, parent, root);
+               parent.add_child (node);
+
+               process_children (node, element);
+       }
+
+       public override void visit_enum_value (Vala.EnumValue element) {
+               Node parent = get_parent_node_for (element);
+
+               SymbolNode node = new EnumValue (settings, element, parent, root);
+               parent.add_child (node);
+
+               process_children (node, element);
+       }
+
+       public override void visit_constant (Vala.Constant element) {
+               Node parent = get_parent_node_for (element);
+
+               SymbolNode node = new Constant (settings, element, parent, root);
+               parent.add_child (node);
+
+               process_children (node, element);
+       }
+
+       public override void visit_error_domain (Vala.ErrorDomain element) {
+               Node parent = get_parent_node_for (element);
+
+               SymbolNode node = new ErrorDomain (settings, element, parent, root);
+               parent.add_child (node);
+
+               process_children (node, element);
+       }
+
+       public override void visit_error_code (Vala.ErrorCode element) {
+               Node parent = get_parent_node_for (element);
+
+               SymbolNode node = new ErrorCode (settings, element, parent, root);
+               parent.add_child (node);
+
+               process_children (node, element);
+       }
+
+       public override void visit_type_parameter (Vala.TypeParameter element) {
+               Node parent = get_parent_node_for (element);
+
+               SymbolNode node = new TypeParameter (settings, element, parent, root);
+               parent.add_child (node);
+
+               process_children (node, element);
+       }
+
+       public override void visit_formal_parameter (Vala.FormalParameter element) {
+               Node parent = get_parent_node_for (element);
+
+               SymbolNode node = new FormalParameter (settings, element, parent, root);
+               parent.add_child (node);
+
+               process_children (node, element);
+       }
+}
index c48d9d2dc8a25861c03349feaf688086359af303..bf349a684cba6ab55198659a8bb245112502b21e 100644 (file)
@@ -27,7 +27,7 @@ using Gee;
 public Valadoc.Class glib_error = null;
 
 
-public class Valadoc.Tree : Vala.CodeVisitor {
+public class Valadoc.Tree {
        private Gee.ArrayList<Package> packages = new Gee.ArrayList<Package>();
        private Package source_package = null;
        private Valadoc.Settings settings;
@@ -94,106 +94,12 @@ public class Valadoc.Tree : Vala.CodeVisitor {
        }
 
        private string[] split_name (string full_name) {
-               string[] params = full_name.split( ".", -1 );
-               int i = 0; while ( params[i] != null ) i++;
+               string[] params = full_name.split (".", -1);
+               int i = 0; while (params[i] != null) i++;
                params.length = i;
                return params;
        }
 
-       public override void visit_namespace ( Vala.Namespace vns ) {
-               vns.accept_children ( this );
-       }
-
-       public override void visit_class ( Vala.Class vcl ) {
-               if ( vcl.parent_symbol is Vala.Namespace == false )
-                       return ;
-
-               Vala.SourceFile vfile = vcl.source_reference.file;
-               Package file = this.find_file(vfile);
-               Namespace ns = file.get_namespace (vcl);
-               ns.add_class ( vcl );
-       }
-
-       public override void visit_interface ( Vala.Interface viface ) {
-               if ( viface.parent_symbol is Vala.Namespace == false )
-                       return ;
-
-               Vala.SourceFile vfile = viface.source_reference.file;
-               Package file = this.find_file( vfile );
-               Namespace ns = file.get_namespace ( viface );
-               ns.add_interface ( viface );
-       }
-
-       public override void visit_struct ( Vala.Struct vstru ) {
-               if ( vstru.parent_symbol is Vala.Namespace == false )
-                       return ;
-
-               Vala.SourceFile vfile = vstru.source_reference.file;
-               Package file = this.find_file( vfile );
-               Namespace ns = file.get_namespace ( vstru );
-               ns.add_struct ( vstru );
-       }
-
-       public override void visit_field ( Vala.Field vf ) {
-               if ( vf.parent_symbol is Vala.Namespace == false )
-                       return ;
-
-               Vala.SourceFile vfile = vf.source_reference.file;
-               Package file = this.find_file( vfile );
-               Namespace ns = file.get_namespace ( vf );
-               ns.add_field ( vf );
-       }
-
-       public override void visit_method ( Vala.Method vm ) {
-               if ( vm.parent_symbol is Vala.Namespace == false )
-                       return ;
-
-               Vala.SourceFile vfile = vm.source_reference.file;
-               Package file = this.find_file( vfile );
-               Namespace ns = file.get_namespace ( vm );
-               ns.add_method ( vm );
-       }
-
-       public override void visit_delegate ( Vala.Delegate vd ) {
-               if ( vd.parent_symbol is Vala.Namespace == false )
-                       return ;
-
-               Vala.SourceFile vfile = vd.source_reference.file;
-               Package file = this.find_file( vfile );
-               Namespace ns = file.get_namespace ( vd );
-               ns.add_delegate ( vd );
-       }
-
-       public override void visit_enum ( Vala.Enum venum ) {
-               if ( venum.parent_symbol is Vala.Namespace == false )
-                       return ;
-
-               Vala.SourceFile vfile = venum.source_reference.file;
-               Package file = this.find_file( vfile );
-               Namespace ns = file.get_namespace ( venum );
-               ns.add_enum ( venum );
-       }
-
-       public override void visit_constant ( Vala.Constant vc ) {
-               if ( vc.parent_symbol is Vala.Namespace == false )
-                       return ;
-
-               Vala.SourceFile vfile = vc.source_reference.file;
-               Package file = this.find_file( vfile );
-               Namespace ns = file.get_namespace ( vc );
-               ns.add_constant ( vc );
-       }
-
-       public override void visit_error_domain ( Vala.ErrorDomain verrdom ) {
-               if ( verrdom.parent_symbol is Vala.Namespace == false )
-                       return ;
-
-               Vala.SourceFile vfile = verrdom.source_reference.file;
-               Package file = this.find_file( vfile );
-               Namespace ns = file.get_namespace ( verrdom );
-               ns.add_error_domain ( verrdom );
-       }
-
        public Tree ( Valadoc.ErrorReporter reporter, Valadoc.Settings settings) {
                this.context = new Vala.CodeContext ( );
                CodeContext.push (context);
@@ -391,7 +297,8 @@ public class Valadoc.Tree : Vala.CodeVisitor {
                        }
                }
 
-               this.context.accept(this);
+               Api.NodeBuilder builder = new Api.NodeBuilder (settings, this);
+               this.context.accept(builder);
                this.resolve_type_references ();
                this.add_dependencies_to_source_package ();
                return true;
index 3ca2f57be3ec797bac51620bf89f45a3782d6700..5119c6cded7f2e377d69c26593568d87d0a769a7 100644 (file)
@@ -27,7 +27,7 @@ public class Valadoc.Class : Api.TypeSymbolNode, ClassHandler, StructHandler, Si
        private Gee.ArrayList<Interface> interfaces;
        private Vala.Class vclass;
 
-       public Class (Valadoc.Settings settings, Vala.Class symbol, ClassHandler parent, Tree root) {
+       public Class (Valadoc.Settings settings, Vala.Class symbol, Api.Node parent, Tree root) {
                base (settings, symbol, parent, root);
                this.interfaces = new Gee.ArrayList<Interface>();
 
@@ -38,36 +38,6 @@ public class Valadoc.Class : Api.TypeSymbolNode, ClassHandler, StructHandler, Si
                                glib_error = this;
                        }
                }
-
-               var vtparams = this.vclass.get_type_parameters ();
-               this.set_template_parameter_list ( vtparams );
-
-               Gee.Collection<Vala.Enum> venums = this.vclass.get_enums ();
-               this.add_enums ( venums );
-
-               Gee.Collection<Vala.Delegate> vdelegates = this.vclass.get_delegates ();
-               this.add_delegates ( vdelegates );
-
-               Gee.Collection<Vala.Class> vclasses = this.vclass.get_classes();
-               this.add_classes ( vclasses );
-
-               Gee.Collection<Vala.Struct> vstructs = this.vclass.get_structs();
-               this.add_structs ( vstructs );
-
-               Gee.Collection<Vala.Field> vfields = this.vclass.get_fields();
-               this.add_fields ( vfields );
-
-               Gee.Collection<Vala.Method> vmethods = this.vclass.get_methods ();
-               this.add_methods_and_construction_methods ( vmethods );
-
-               Gee.Collection<Vala.Signal> vsignals = this.vclass.get_signals();
-               this.add_signals ( vsignals );
-
-               Gee.Collection<Vala.Property> vproperties = this.vclass.get_properties();
-               this.add_properties ( vproperties );
-
-               Gee.Collection<Vala.Constant> vconstants = this.vclass.get_constants();
-               this.add_constants ( vconstants );
        }
 
        protected Class? base_type {
index fef2f9dcd1b095f7b45ba1e2de0cfb3cdfa125f1..ed3837830785ff76077726d092f27afce5392de2 100644 (file)
@@ -38,17 +38,6 @@ public interface Valadoc.ClassHandler : Api.Node {
                return get_children_by_type (Api.NodeType.CLASS);
        }
 
-       internal void add_class ( Vala.Class vcl ) {
-               Class cl = new Class ( this.settings, vcl, this, this.head );
-               add_child ( cl );
-       }
-
-       public void add_classes ( Gee.Collection<Vala.Class> vclasses ) {
-               foreach ( Vala.Class vcl in vclasses ) {
-                       this.add_class ( vcl );
-               }
-       }
-
        public void visit_classes ( Doclet doclet ) {
                accept_children_by_type (Api.NodeType.CLASS, doclet);
        }
index eb667f139fd09572ea284a68b20b73c06a5c2c24..cf6f873e3306d8faa00a3538183d74f324dbdbd3 100644 (file)
@@ -35,7 +35,7 @@ public class Valadoc.Constant : Api.MemberNode, ReturnTypeHandler {
                return ( this.vconst == vconst );
        }
 
-       public Constant (Valadoc.Settings settings, Vala.Constant symbol, ConstantHandler parent, Tree root) {
+       public Constant (Valadoc.Settings settings, Vala.Constant symbol, Api.Node parent, Tree root) {
                base (settings, symbol, parent, root);
                this.vconst = symbol;
 
index fc11201ba310ac0d0e3b2b6369ae754f13f7201b..c9a152beb6f7f81ac1e6514eb4067101448d285e 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-
 using Vala;
 using GLib;
 using Gee;
 
-
 public interface Valadoc.ConstantHandler : Api.Node {
-       public Gee.Collection<Constant> get_constant_list ( ) {
+       public Gee.Collection<Constant> get_constant_list () {
                return get_children_by_type (Api.NodeType.CONSTANT);
        }
 
-       internal void add_constants (Gee.Collection<Vala.Constant> vconstants) {
-               foreach (Vala.Constant vc in vconstants) {
-                       this.add_constant (vc);
-               }
-       }
-
-       internal void add_constant (Vala.Constant vc) {
-               var tmp = new Constant (this.settings, vc, this, this.head);
-               add_child ( tmp );
-       }
-
-       public void visit_constants ( Doclet doclet ) {
+       public void visit_constants (Doclet doclet) {
                accept_children_by_type (Api.NodeType.CONSTANT, doclet);
        }
 }
-
index b1d5c1038f8b28b0322641fccb939d2d0cd84d5f..d54e111cd2aadabe77fcd2fa20ff396d4c0f574d 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-
 using Vala;
 using GLib;
 using Gee;
 
-
-public interface Valadoc.ConstructionMethodHandler : Basic, MethodHandler {
+public interface Valadoc.ConstructionMethodHandler : Api.Node {
        public Gee.Collection<Method> get_construction_method_list () {
                return get_children_by_type (Api.NodeType.CREATION_METHOD);
        }
@@ -31,21 +29,4 @@ public interface Valadoc.ConstructionMethodHandler : Basic, MethodHandler {
        public void visit_construction_methods ( Doclet doclet ) {
                accept_children_by_type (Api.NodeType.CREATION_METHOD, doclet);
        }
-
-       protected void add_construction_method ( Vala.CreationMethod vm ) {
-               var tmp = new Method ( this.settings, vm, this, this.head );
-               add_child ( tmp );
-       }
-
-       protected void add_methods_and_construction_methods ( Gee.Collection<Vala.Method> vmethods ) {
-               foreach ( Vala.Method vm in vmethods ) {
-                       if ( vm is Vala.CreationMethod ) {
-                               this.add_construction_method ( (Vala.CreationMethod)vm );
-                       }
-                       else {
-                               this.add_method ( vm );
-                       }
-               }
-       }
 }
-
index d2a113e01d1cf579679fa44e5620e450b8fcba1f..445d526ec6b03a9ffb3d55b393c0b8c1c35dfb38 100644 (file)
@@ -26,16 +26,13 @@ using Gee;
 public class Valadoc.Delegate : Api.TypeSymbolNode, ParameterListHandler, ReturnTypeHandler, TemplateParameterListHandler, ExceptionHandler {
        private Vala.Delegate vdelegate;
 
-       public Delegate (Valadoc.Settings settings, Vala.Delegate symbol, DelegateHandler parent, Tree root) {
+       public Delegate (Valadoc.Settings settings, Vala.Delegate symbol, Api.Node parent, Tree root) {
                base (settings, symbol, parent, root);
 
                this.vdelegate = symbol;
 
                var ret = this.vdelegate.return_type;
                this.set_ret_type ( ret );
-
-               var vparamlst = this.vdelegate.get_parameters ();
-               this.add_parameter_list ( vparamlst );
        }
 
        public string? get_cname () {
index a4ac4f4436f2873c321d6306af6c03d1579b715f..abd2306e4f49e16f22664841d8bf5e60725be835 100644 (file)
@@ -29,15 +29,4 @@ public interface Valadoc.DelegateHandler : Api.Node {
        public void visit_delegates ( Doclet doclet ) {
                accept_children_by_type (Api.NodeType.DELEGATE, doclet);
        }
-
-       public void add_delegates ( Gee.Collection<Vala.Delegate> vdels ) {
-               foreach ( Vala.Delegate vdel in vdels ) {
-                       this.add_delegate ( vdel );
-               }
-       }
-
-       public void add_delegate ( Vala.Delegate vdel ) {
-               var tmp = new Delegate ( this.settings, vdel, this, this.head );
-               add_child ( tmp );
-       }
 }
index 563a01ca715a12dbc3fdd06ea2fc06425501fcea..2d669b74de18cd5b91362d0b5f69c7b547becfe2 100644 (file)
@@ -24,15 +24,9 @@ using Gee;
 
 
 public class Valadoc.Enum : Api.TypeSymbolNode, MethodHandler {
-       public Enum (Valadoc.Settings settings, Vala.Enum symbol, EnumHandler parent, Tree root) {
+       public Enum (Valadoc.Settings settings, Vala.Enum symbol, Api.Node parent, Tree root) {
                base (settings, symbol, parent, root);
                this.venum = symbol;
-
-               Gee.Collection<Vala.Method> vmethods = this.venum.get_methods ();
-               this.add_methods ( vmethods );
-
-               Gee.Collection<Vala.EnumValue> venvals = this.venum.get_values ();
-               this.add_enum_values ( venvals );
        }
 
        public string? get_cname () {
@@ -44,13 +38,6 @@ public class Valadoc.Enum : Api.TypeSymbolNode, MethodHandler {
                return get_children_by_type (Api.NodeType.ENUM_VALUE);
        }
 
-       private inline void add_enum_values ( Gee.Collection<Vala.EnumValue> venvals ) {
-               foreach ( Vala.EnumValue venval in venvals ) {
-                       var tmp = new EnumValue ( this.settings, venval, this, this.head );
-                       add_child ( tmp );
-               }
-       }
-
        public void visit_enum_values ( Doclet doclet ) {
                accept_children_by_type (Api.NodeType.ENUM_VALUE, doclet);
        }
index fbdded94e212395be380b8aed3a9a5b57b91b89f..ff226344705b2fa662b1a605e612ccfedc9a8412 100644 (file)
@@ -26,7 +26,7 @@ using Gee;
 public class Valadoc.EnumValue: Api.SymbolNode {
        private Vala.EnumValue venval;
 
-       public EnumValue (Valadoc.Settings settings, Vala.EnumValue symbol, Enum parent, Tree root) {
+       public EnumValue (Valadoc.Settings settings, Vala.EnumValue symbol, Api.Node parent, Tree root) {
                base (settings, symbol, parent, root);
                this.venval = symbol;
        }
index a5248833012b8c62b99c09d57498fa10fe8807a9..d0fa8a0b5a0d389688b774c2b80cdd3a172e3bab 100644 (file)
@@ -26,7 +26,7 @@ using Gee;
 public class Valadoc.ErrorCode : Api.TypeSymbolNode {
        private Vala.ErrorCode verrcode;
 
-       public ErrorCode (Valadoc.Settings settings, Vala.ErrorCode symbol, ErrorDomain parent, Tree root) {
+       public ErrorCode (Valadoc.Settings settings, Vala.ErrorCode symbol, Api.Node parent, Tree root) {
                base (settings, symbol, parent, root);
                this.verrcode = symbol;
        }
index 283de0c7594c2af8cb43ee1d7d198547611571b9..af4fc5b6a701845d3d47514146e2ca4595836db0 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
-
 using Vala;
 using GLib;
 using Gee;
 
-
 public class Valadoc.ErrorDomain : Api.TypeSymbolNode, MethodHandler {
        private Vala.ErrorDomain verrdom;
 
-       public ErrorDomain (Valadoc.Settings settings, Vala.ErrorDomain symbol, ErrorDomainHandler parent, Tree root) {
+       public ErrorDomain (Valadoc.Settings settings, Vala.ErrorDomain symbol, Api.Node parent, Tree root) {
                base (settings, symbol, parent, root);
                this.verrdom = symbol;
-
-               Gee.Collection<Vala.Method> vmethods = this.verrdom.get_methods ();
-               this.add_methods ( vmethods );
-
-               Gee.Collection<Vala.ErrorCode> verrcodes = this.verrdom.get_codes ();
-               this.append_error_code ( verrcodes );
        }
 
        public string? get_cname () {
                return this.verrdom.get_cname();
        }
 
-       public void visit_error_codes ( Doclet doclet ) {
+       public void visit_error_codes (Doclet doclet) {
                accept_children_by_type (Api.NodeType.ERROR_CODE, doclet);
        }
 
@@ -49,7 +41,7 @@ public class Valadoc.ErrorDomain : Api.TypeSymbolNode, MethodHandler {
                return get_children_by_type (Api.NodeType.ERROR_CODE);
        }
 
-       public void visit ( Doclet doclet ) {
+       public void visit (Doclet doclet) {
                if ( !this.is_visitor_accessible ( ) )
                        return ;
 
@@ -65,12 +57,4 @@ public class Valadoc.ErrorDomain : Api.TypeSymbolNode, MethodHandler {
        public void write ( Langlet langlet, void* ptr ) {
                langlet.write_error_domain ( this, ptr );
        }
-
-       private inline void append_error_code ( Gee.Collection<Vala.ErrorCode> verrcodes ) {
-               foreach ( Vala.ErrorCode verrcode in verrcodes ) {
-                       var tmp = new ErrorCode ( this.settings, verrcode, this, this.head );
-                       add_child ( tmp );
-               }
-       }
 }
-
index 168e5e0432ffc7b29e1f90adabc4d574408e4a85..cce01bddbf736729bc69ed15eceaa6ac215801a7 100644 (file)
@@ -29,15 +29,4 @@ public interface Valadoc.ErrorDomainHandler : Api.Node {
        public void visit_error_domains (Doclet doclet) {
                accept_children_by_type (Api.NodeType.ERROR_DOMAIN, doclet);
        }
-
-       public void add_error_domains (Gee.Collection<Vala.ErrorDomain> verrdoms) {
-               foreach ( Vala.ErrorDomain verrdom in  verrdoms ) {
-                       this.add_error_domain ( verrdom );
-               }
-       }
-
-       public void add_error_domain ( Vala.ErrorDomain verrdom ) {
-               var tmp = new ErrorDomain ( this.settings, verrdom, this, this.head );
-               add_child ( tmp );
-       }
 }
index 646fc7e5dbed43306207493a9d7e2609cca36a2d..cdfaf29614d3cd0bb0d8397d4c71f154b9cb754a 100644 (file)
@@ -26,7 +26,7 @@ using Gee;
 public class Valadoc.Field : Api.MemberNode, ReturnTypeHandler {
        private Vala.Field vfield;
 
-       public Field (Valadoc.Settings settings, Vala.Field symbol, FieldHandler parent, Tree root) {
+       public Field (Valadoc.Settings settings, Vala.Field symbol, Api.Node parent, Tree root) {
                base (settings, symbol, parent, root);
                this.vfield = symbol;
 
index 0b867bb251e74380e006d50682034806bb4dbe7d..37605f825571152c69ed3d975ea9936f085674c8 100644 (file)
@@ -22,22 +22,11 @@ using GLib;
 using Gee;
 
 public interface Valadoc.FieldHandler : Api.Node {
-       public Gee.Collection<Field> get_field_list ( ) {
+       public Gee.Collection<Field> get_field_list () {
                return get_children_by_type (Api.NodeType.FIELD);
        }
 
-       internal void add_fields ( Gee.Collection<Vala.Field> vfields ) {
-               foreach ( Vala.Field vf in vfields ) {
-                       this.add_field ( vf );
-               }
-       }
-
-       internal void add_field ( Vala.Field vf ) {
-               var tmp = new Field ( this.settings, vf, this, this.head );
-               add_child ( tmp );
-       }
-
-       public void visit_fields ( Doclet doclet ) {
+       public void visit_fields (Doclet doclet) {
                accept_children_by_type (Api.NodeType.FIELD, doclet);
        }
 }
index 4887a1c5ce5db82fd152bd34c8300671e6b43e92..4ac9d8371a47e53b05761109fa000fd0a91f9237 100644 (file)
@@ -24,7 +24,7 @@ using Gee;
 public class Valadoc.FormalParameter : Api.SymbolNode, ReturnTypeHandler {
        private Vala.FormalParameter vformalparam;
 
-       public FormalParameter (Valadoc.Settings settings, Vala.FormalParameter symbol, ParameterListHandler parent, Tree root) {
+       public FormalParameter (Valadoc.Settings settings, Vala.FormalParameter symbol, Api.Node parent, Tree root) {
                base (settings, symbol, parent, root);
                this.vformalparam = symbol;
 
index f078674e1cc34176b3c72265870f2ade72decebe..43f90a8ea8f0e22c8ccece565bd07e8c82b7e039 100644 (file)
@@ -24,39 +24,9 @@ using Gee;
 
 
 public class Valadoc.Interface : Api.TypeSymbolNode, SignalHandler, PropertyHandler, FieldHandler, ConstantHandler, TemplateParameterListHandler, MethodHandler, DelegateHandler, EnumHandler, StructHandler, ClassHandler {
-       public Interface (Valadoc.Settings settings, Vala.Interface symbol, InterfaceHandler parent, Tree root) {
+       public Interface (Valadoc.Settings settings, Vala.Interface symbol, Api.Node parent, Tree root) {
                base (settings, symbol, parent, root);
                this.vinterface = symbol;
-
-               var vtparams = this.vinterface.get_type_parameters ();
-               this.set_template_parameter_list (vtparams);
-
-               Gee.Collection<Vala.Method> methods = this.vinterface.get_methods ();
-               this.add_methods (methods);
-
-               Gee.Collection<Vala.Delegate> delegates = this.vinterface.get_delegates ();
-               this.add_delegates (delegates);
-
-               Gee.Collection<Vala.Signal> signals = this.vinterface.get_signals();
-               this.add_signals (signals);
-
-               Gee.Collection<Vala.Property> properties = this.vinterface.get_properties();
-               this.add_properties (properties);
-
-               Gee.Collection<Vala.Field> fields = this.vinterface.get_fields();
-               this.add_fields (fields);
-
-               Gee.Collection<Vala.Struct> structs = this.vinterface.get_structs();
-               this.add_structs (structs);
-
-               Gee.Collection<Vala.Class> classes = this.vinterface.get_classes();
-               this.add_classes (classes);
-
-               Gee.Collection<Vala.Enum> enums = this.vinterface.get_enums();
-               this.add_enums (enums);
-
-               Gee.Collection<Vala.Constant> constants = this.vinterface.get_constants();
-               this.add_constants ( constants );
        }
 
        private Gee.ArrayList<Interface> interfaces = new Gee.ArrayList<Interface>();
index c2c1455d35428206ee2555ae2eda173dbd369e97..8e69095fa72b82206ddef9059ea09d093d57598d 100644 (file)
@@ -22,22 +22,11 @@ using GLib;
 using Gee;
 
 public interface Valadoc.InterfaceHandler : Api.Node {
-       public Gee.Collection<Interface> get_interface_list ( ) {
+       public Gee.Collection<Interface> get_interface_list () {
                return get_children_by_type (Api.NodeType.INTERFACE);
        }
 
-       public void visit_interfaces ( Doclet doclet ) {
+       public void visit_interfaces (Doclet doclet) {
                accept_children_by_type (Api.NodeType.INTERFACE, doclet);
        }
-
-       protected void add_interfaces ( Gee.Collection<Vala.Interface> vifaces ) {
-               foreach ( Vala.Interface viface in vifaces ) {
-                       this.add_interface ( viface );
-               }
-       }
-
-       internal void add_interface ( Vala.Interface viface ) {
-               var tmp = new Interface ( this.settings, viface, this, this.head );
-               add_child (tmp);
-       }
 }
index 1367aba6c8ef0f8dfa23280f92b96d5d29b741ad..2845c042d65f4bcdda67646b7fca958cd6f71507 100644 (file)
@@ -26,18 +26,12 @@ using Gee;
 public class Valadoc.Method : Api.MemberNode, ParameterListHandler, ExceptionHandler, TemplateParameterListHandler, ReturnTypeHandler {
        private Vala.Method vmethod;
 
-       public Method (Valadoc.Settings settings, Vala.Method symbol, MethodHandler parent, Tree root) {
+       public Method (Valadoc.Settings settings, Vala.Method symbol, Api.Node parent, Tree root) {
                base (settings, symbol, parent, root);
                this.vmethod = symbol;
 
                var vret = this.vmethod.return_type;
                this.set_ret_type (vret);
-
-               var vparamlst = this.vmethod.get_parameters ();
-               this.add_parameter_list (vparamlst);
-
-               var vtparams = this.vmethod.get_type_parameters ();
-               this.set_template_parameter_list (vtparams);
        }
 
        public string? get_cname () {
index 20e1b75b3852340af4e5fed3e8507db05a92ba6b..b4d9a836a03404f2891387a8a0107624be9b6474 100644 (file)
@@ -22,22 +22,11 @@ using GLib;
 using Gee;
 
 public interface Valadoc.MethodHandler : Api.Node {
-       protected void add_method ( Vala.Method vmethod ) {
-               var tmp = new Method ( this.settings, vmethod, this, this.head );
-               add_child ( tmp );
-       }
-
-       protected void add_methods ( Gee.Collection<Vala.Method> vmethods ) {
-               foreach ( Vala.Method vm in vmethods ) {
-                       this.add_method ( vm );
-               }
-       }
-
-       public void visit_methods ( Doclet doclet ) {
+       public void visit_methods (Doclet doclet) {
                accept_children_by_type (Api.NodeType.METHOD, doclet);
        }
 
-       public Gee.Collection<Method> get_method_list ( ) {
+       public Gee.Collection<Method> get_method_list () {
                return get_children_by_type (Api.NodeType.METHOD);
        }
 }
index ad80b5b525aaf80b39db9dd8bde2e4a58636aea8..088ebcec5eb39c581ba40d681750467a5ba4d03d 100644 (file)
@@ -107,10 +107,15 @@ public class Valadoc.Package : Api.Node, NamespaceHandler {
                }
        }
 
+       // TODO Remove
        internal bool is_vpackage (Vala.SourceFile vfile) {
                return this.vfiles.contains (vfile);
        }
 
+       internal bool is_package_for_file (Vala.SourceFile source_file) {
+               return this.vfiles.contains (source_file);
+       }
+
        protected override bool is_type_visitor_accessible (Valadoc.Basic element) {
                return true;
        }
index 10ff9c40e86dc66f6cb6b56fd9209af4e680048c..4a6263f79f002be99d61bef2445fca746b77b289 100644 (file)
@@ -30,11 +30,4 @@ public interface Valadoc.ParameterListHandler : Api.Node {
        public Gee.List<FormalParameter> get_parameter_list () {
                return (Gee.List<FormalParameter>) get_children_by_type (Api.NodeType.FORMAL_PARAMETER);
        }
-
-       protected void add_parameter_list (Gee.Collection<Vala.FormalParameter> vparams) {
-               foreach (Vala.FormalParameter vfparam in vparams) {
-                       var tmp = new FormalParameter (this.settings, vfparam, this, this.head);
-                       add_child (tmp);
-               }
-       }
 }
index 0817a2c831a29fadecd531dc031c61fe04917f82..01eacc685df1c55d32e0db2713edae4e71f72bea 100644 (file)
@@ -26,7 +26,7 @@ using Gee;
 public class Valadoc.Property : Api.MemberNode, ReturnTypeHandler {
        private Vala.Property vproperty;
 
-       public Property (Valadoc.Settings settings, Vala.Property symbol, PropertyHandler parent, Tree root) {
+       public Property (Valadoc.Settings settings, Vala.Property symbol, Api.Node parent, Tree root) {
                base (settings, symbol, parent, root);
 
                this.vproperty = symbol;
index 3b7fa2c0a348d259384dca63e272ecb89117fdcd..04bfd675d1b0051845414ccbac92c4bb401662f0 100644 (file)
@@ -22,32 +22,25 @@ using GLib;
 using Gee;
 
 public interface Valadoc.PropertyHandler : Api.Node {
-       protected bool is_overwritten_property ( Property prop ) {
-               foreach ( Property p in get_property_list () ) {
-                       if ( p.parent != this )
+       protected bool is_overwritten_property (Property prop) {
+               foreach (Property p in get_property_list ()) {
+                       if (p.parent != this)
                                continue ;
 
-                       if ( !p.is_override )
+                       if (!p.is_override)
                                continue ;
 
-                       if ( p.equals ( prop ) )
+                       if (p.equals (prop))
                                return true;
                }
                return false;
        }
 
-       public Gee.Collection<Property> get_property_list ( ) {
+       public Gee.Collection<Property> get_property_list () {
                return get_children_by_type (Api.NodeType.PROPERTY);
        }
 
-       public void visit_properties ( Doclet doclet ) {
+       public void visit_properties (Doclet doclet) {
                accept_children_by_type (Api.NodeType.PROPERTY, doclet);
        }
-
-       protected void add_properties ( Gee.Collection<Vala.Property> vproperties ) {
-               foreach ( Vala.Property vprop in vproperties ) {
-                       var tmp = new Property ( this.settings, vprop, this, this.head );
-                       add_child ( tmp );
-               }
-       }
 }
index 2af364d4a511b943472552583dcc558b479d188b..c59d8c1c9c8508bf4b3505b563e390b440ab8c98 100644 (file)
@@ -26,15 +26,11 @@ using Gee;
 public class Valadoc.Signal : Api.MemberNode, ParameterListHandler, ReturnTypeHandler {
        private Vala.Signal vsignal;
 
-       public Signal (Valadoc.Settings settings, Vala.Signal symbol, SignalHandler parent, Tree root) {
+       public Signal (Valadoc.Settings settings, Vala.Signal symbol, Api.Node parent, Tree root) {
                base (settings, symbol, parent, root);
 
                this.vsignal = symbol;
 
-               this.param_list = new Gee.ArrayList<FormalParameter> ();
-               var vparamlst = this.vsignal.get_parameters ();
-               this.add_parameter_list (vparamlst);
-
                var ret = this.vsignal.return_type;
                this.set_ret_type (ret);
        }
@@ -48,11 +44,6 @@ public class Valadoc.Signal : Api.MemberNode, ParameterListHandler, ReturnTypeHa
                get;
        }
 
-       protected Gee.ArrayList<FormalParameter> param_list {
-               protected set;
-               get;
-       }
-
        protected override void resolve_type_references () {
                this.set_return_type_references ( );
 
index 834b06ccaf67930bb7b263a5b21b78a948d32729..464f94a62c2a64ff81a9847c3a07ead0032670de 100644 (file)
@@ -22,14 +22,7 @@ using GLib;
 using Gee;
 
 public interface Valadoc.SignalHandler : Api.Node {
-       internal void add_signals ( Gee.Collection<Vala.Signal> vsignals ) {
-               foreach ( Vala.Signal vsig in vsignals ) {
-                       var tmp = new Signal ( this.settings, vsig, this, this.head );
-                       add_child ( tmp );
-               }
-       }
-
-       public void visit_signals ( Doclet doclet ) {
+       public void visit_signals (Doclet doclet) {
                accept_children_by_type (Api.NodeType.SIGNAL, doclet);
        }
 
index b84ed98165570e3c5a55cc018a8a4fc80747d7a9..f5c4b7511308b2d321dd8b1d7d14453120a9e89c 100644 (file)
@@ -26,21 +26,9 @@ using Gee;
 public class Valadoc.Struct : Api.TypeSymbolNode, MethodHandler, ConstructionMethodHandler, FieldHandler, ConstantHandler, TemplateParameterListHandler {
        private Vala.Struct vstruct;
 
-       public Struct (Valadoc.Settings settings, Vala.Struct symbol, StructHandler parent, Tree root) {
+       public Struct (Valadoc.Settings settings, Vala.Struct symbol, Api.Node parent, Tree root) {
                base (settings, symbol, parent, root);
                this.vstruct = symbol;
-
-               var vtparams = this.vstruct.get_type_parameters ();
-               this.set_template_parameter_list (vtparams);
-
-               Gee.Collection<Vala.Field> vfields = this.vstruct.get_fields();
-               this.add_fields (vfields);
-
-               Gee.Collection<Vala.Constant> vconstants = this.vstruct.get_constants();
-               this.add_constants (vconstants);
-
-               Gee.Collection<Vala.Method> vmethods = this.vstruct.get_methods ();
-               this.add_methods_and_construction_methods (vmethods);
        }
 
        protected Struct? base_type {
index dbc49e02e61751b8f321e321a1a5e488be9a37c3..64784d1d41685d97f54f66a90649d480172b0d84 100644 (file)
@@ -22,22 +22,11 @@ using GLib;
 using Gee;
 
 public interface Valadoc.StructHandler : Api.Node {
-       public Gee.Collection<Struct> get_struct_list ( ) {
+       public Gee.Collection<Struct> get_struct_list () {
                return get_children_by_type (Api.NodeType.STRUCT);
        }
 
-       public void add_struct ( Vala.Struct vstru ) {
-               Struct stru = new Struct ( this.settings, vstru, this, this.head );
-               add_child (stru);
-       }
-
-       public void add_structs ( Gee.Collection<Vala.Struct> vstructs ) {
-               foreach ( Vala.Struct vstru in vstructs ) {
-                       this.add_struct ( vstru );
-               }
-       }
-
-       public void visit_structs ( Doclet doclet ) {
+       public void visit_structs (Doclet doclet) {
                accept_children_by_type (Api.NodeType.STRUCT, doclet);
        }
 }
index 6c2a490b8866f4e2e395c5f4a61f68f74e8a4e45..c1d20db0f8b9ba35a908bc183ad8b67ee788a414 100644 (file)
@@ -25,11 +25,4 @@ public interface Valadoc.TemplateParameterListHandler : Api.Node {
        public Gee.Collection<TypeParameter> get_template_param_list () {
                return get_children_by_type (Api.NodeType.TYPE_PARAMETER);
        }
-
-       internal void set_template_parameter_list (Gee.Collection<Vala.TypeParameter> vtparams) {
-               foreach ( Vala.TypeParameter vtparam in vtparams ) {
-                       var tmp = new TypeParameter (this.settings, vtparam, this, this.head);
-                       add_child (tmp);
-               }
-       }
 }
index b4da0033a3935e996d70b4ebf551461196e10dc2..67116c6154b256f137397bbb60b95f1501cce83d 100644 (file)
@@ -25,7 +25,7 @@ using Gee;
 
 public class Valadoc.TypeParameter : Api.SymbolNode, ReturnTypeHandler {
 
-       public TypeParameter (Valadoc.Settings settings, Vala.TypeParameter symbol, TemplateParameterListHandler parent, Tree root) {
+       public TypeParameter (Valadoc.Settings settings, Vala.TypeParameter symbol, Api.Node parent, Tree root) {
                base (settings, symbol, parent, root);
        }