]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
- @inheritDoc: - structs - classes - properties
authorFlorian Brosch <flobrosch@src.gnome.org>
Mon, 10 Nov 2008 16:00:00 +0000 (16:00 +0000)
committerFlorian Brosch <flobrosch@src.gnome.org>
Mon, 10 Nov 2008 16:00:00 +0000 (16:00 +0000)
 - @inheritDoc:
  - structs
  - classes
  - properties

svn path=/trunk/; revision=17

src/doclets/htmlhelpers/htmlhelpers.vala
src/libvaladoc/doctree.vala
src/libvaladoc/parser.vala

index 214bd6c63ae1a0bb389be046bc1ec38fa9de460f..cfdac952c4e554abf731735428cfa4608184d06f 100644 (file)
@@ -1418,6 +1418,7 @@ public abstract class Valadoc.BasicHtmlDoclet : Valadoc.Doclet {
                m.write_comment ( file );
 
                if ( m.parent is Namespace ) {
+                       file.puts ( "\t\t\t\t<br />\n" );
                        this.write_namespace_note ( file, m );
                        this.write_package_note ( file, m );
                }
@@ -1469,6 +1470,7 @@ public abstract class Valadoc.BasicHtmlDoclet : Valadoc.Doclet {
                del.write_comment ( file );
 
                if ( del.parent is Namespace ) {
+                       file.puts ( "\t\t\t\t<br />\n" );
                        this.write_namespace_note ( file, del );
                        this.write_package_note ( file, del );
                }
@@ -1488,6 +1490,7 @@ public abstract class Valadoc.BasicHtmlDoclet : Valadoc.Doclet {
                field.write_comment ( file );
 
                if ( field.parent is Namespace ) {
+                       file.puts ( "\t\t\t\t<br />\n" );
                        this.write_namespace_note ( file, field );
                        this.write_package_note ( file, field );
                }
@@ -1507,6 +1510,7 @@ public abstract class Valadoc.BasicHtmlDoclet : Valadoc.Doclet {
                constant.write_comment ( file );
 
                if ( constant.parent is Namespace ) {
+                       file.puts ( "\t\t\t\t<br />\n" );
                        this.write_namespace_note ( file, constant );
                        this.write_package_note ( file, constant );
                }
@@ -1536,6 +1540,7 @@ public abstract class Valadoc.BasicHtmlDoclet : Valadoc.Doclet {
                en.write_comment ( file );
 
                if ( en.parent is Namespace ) {
+                       file.puts ( "\t\t\t\t<br />\n" );
                        this.write_namespace_note ( file, en );
                        this.write_package_note ( file, en );
                }
@@ -1630,6 +1635,7 @@ public abstract class Valadoc.BasicHtmlDoclet : Valadoc.Doclet {
                file.printf ( "\n\t\t\t\t</div>\n" );
                cl.write_comment ( file );
                if ( cl.parent is Namespace ) {
+                       file.puts ( "\t\t\t\t<br />\n" );
                        this.write_namespace_note ( file, cl );
                        this.write_package_note ( file, cl );
                }
@@ -1660,6 +1666,7 @@ public abstract class Valadoc.BasicHtmlDoclet : Valadoc.Doclet {
                file.printf ( "\n\t\t\t\t</div>\n" );
                iface.write_comment ( file );
                if ( iface.parent is Namespace ) {
+                       file.puts ( "\t\t\t\t<br />\n" );
                        this.write_namespace_note ( file, iface );
                        this.write_package_note ( file, iface );
                }
@@ -1683,6 +1690,7 @@ public abstract class Valadoc.BasicHtmlDoclet : Valadoc.Doclet {
                file.printf ( "\t\t\t\t<h2 class=\"%s\">Description:</h2>\n", css_title );
                errdom.write_comment ( file );
                if ( errdom.parent is Namespace ) {
+                       file.puts ( "\t\t\t\t<br />\n" );
                        this.write_namespace_note ( file, errdom );
                        this.write_package_note ( file, errdom );
                }
@@ -1707,6 +1715,7 @@ public abstract class Valadoc.BasicHtmlDoclet : Valadoc.Doclet {
 
                stru.write_comment ( file );
                if ( stru.parent is Namespace ) {
+                       file.puts ( "\t\t\t\t<br />\n" );
                        this.write_namespace_note ( file, stru );
                        this.write_package_note ( file, stru );
                }
index cf475f81b238d5ecd782bf07109eaf1c1e8e26ef..4cb28d6ea151c40954ad4ce734c77f360d4bd9a0 100755 (executable)
@@ -2221,13 +2221,37 @@ public class Valadoc.Property : Basic, SymbolAccessibility, ReturnTypeHandler, V
                }
        }
 
+       public Property base_property {
+               private set;
+               get;
+       }
+
        // internal
        public void set_type_references ( ) {
+               if ( this.is_override ) {
+                       Vala.Property vp = ( this.vproperty.base_property == null )? this.vproperty.base_interface_property : this.vproperty.base_property;
+                       this.base_property = this.head.search_vala_symbol ( vp );
+               }
                this.set_return_type_references ( );
        }
 
-       // internal
        public void parse_comment ( Valadoc.Parser docparser ) {
+               if ( this.documentation != null )
+                       return ;
+
+               if ( this.comment_string == null )
+                       return ;
+
+               bool tmp = Parser.is_documentation ( this.comment_string );
+               if ( tmp == false )
+                       return ;
+
+               if ( this.is_override && Parser.is_inherit_doc ( this.comment_string ) ) {
+                       this.base_property.parse_comment ( docparser );
+                       this.documentation = this.base_property.documentation;
+                       return ;
+               }
+
                this.parse_comment_helper ( docparser, CommentContext.PROPERTY );
        }
 
@@ -2349,8 +2373,8 @@ public class Valadoc.Method : Basic, ParameterListHandler, ExceptionHandler, Tem
        }
 
        public Method base_method {
+               private set;
                get;
-               set;
        }
 
        public TypeReference return_type {
@@ -2373,6 +2397,7 @@ public class Valadoc.Method : Basic, ParameterListHandler, ExceptionHandler, Tem
                get;
        }
 
+       // FIXME
        public string?# comment_str {
                get {
                        return this.vmethod.source_reference.comment;
@@ -2498,6 +2523,11 @@ public class Valadoc.Method : Basic, ParameterListHandler, ExceptionHandler, Tem
 
        // internal
        public void set_type_references ( ) {
+               if ( this.is_override ) {
+                       Vala.Method vm = ( this.vmethod.base_method == null )? this.vmethod.base_interface_method : this.vmethod.base_method;
+                       this.base_method = this.head.search_vala_symbol ( vm );
+               }
+
                this.set_return_type_references ( );
 
                this.set_exception_type_references ( );
@@ -2720,7 +2750,8 @@ public abstract class Valadoc.ContainerDataType : DataType, MethodHandler, Visit
                this.methods = new Gee.ArrayList<Method> ();
        }
 
-       protected Class? parent_class {
+       // Rename to parent_element
+       protected ContainerDataType? parent_class {
                private set;
                get;
        }
@@ -2769,6 +2800,9 @@ public abstract class Valadoc.ContainerDataType : DataType, MethodHandler, Visit
                        if ( element is Class ) {
                                this.parent_class = (Class)element;
                        }
+                       else if ( element is Struct ) {
+                               this.parent_class = (Struct)element;
+                       }
                }
        }
 
@@ -3045,7 +3079,21 @@ public class Valadoc.Class : ContainerDataType, Visitable, ClassHandler, StructH
 
        // internal
        public override void parse_comments ( Valadoc.Parser docparser ) {
-               this.parse_comment_helper ( docparser, CommentContext.CLASS );
+               if ( this.documentation != null )
+                       return ;
+
+               if ( this.comment_string != null ) {
+                       bool tmp = Parser.is_documentation ( this.comment_string );
+                       if ( tmp == true ) {
+                               if ( Parser.is_inherit_doc ( this.comment_string ) && this.parent_class != null ) {
+                                       this.parent_class.parse_comments ( docparser );
+                                       this.documentation = this.parent_class.documentation;
+                               }
+                               else {
+                                       this.parse_comment_helper ( docparser, CommentContext.CLASS );
+                               }
+                       }
+               }
 
                this.parse_construction_method_comments ( docparser );
                this.parse_delegate_comments ( docparser );
@@ -3084,12 +3132,12 @@ public class Valadoc.Class : ContainerDataType, Visitable, ClassHandler, StructH
                foreach ( Field f in flst ) {
                        this.fields.add ( f );
                }
-
+/*
                var plst = dtype.get_property_list ( );
                foreach ( Property prop in plst ) {
                        this.properties.add ( prop );
                }
-
+*/
                var proplst = dtype.get_property_list ( );
                foreach ( Property p in proplst ) {
                        if ( p.is_private )
@@ -3108,31 +3156,13 @@ public class Valadoc.Class : ContainerDataType, Visitable, ClassHandler, StructH
                        if ( m.is_private )
                                continue ;
 
-                       if ( m.is_virtual || m.is_override || m.is_abstract ) {
-                               Method m2 = get_new_method ( m );
-                               if ( m2 != null )
-                                       m2.base_method = m;
-                                       continue ;
-                       }
-
                        this.methods.add ( m );
                }
        }
 
-       // rename - base_method?
-       private Method? get_new_method ( Method overwritten_method ) {
-               foreach ( Method m in this.methods ) {
-                       if ( !m.is_override )
-                               continue ;
-
-                       if ( m.name == overwritten_method.name  )
-                               return m;                       
-               }
-               return null;
-       }
-
        private void inheritance_interface ( Interface dtype ) {
                var plst = dtype.get_property_list ( );
+
                foreach ( Property p in plst ) {
                        if ( p.is_private )
                                continue ;
@@ -3621,6 +3651,7 @@ public class Valadoc.Struct : ContainerDataType, Visitable, ConstructionMethodHa
                this.add_methods_and_construction_methods ( vmethods );
        }
 
+       // TODO remove
        public string?# comment_str {
                get {
                        return this.vstruct.source_reference.comment;
@@ -3650,7 +3681,27 @@ public class Valadoc.Struct : ContainerDataType, Visitable, ConstructionMethodHa
 
        // internal
        public override void parse_comments ( Valadoc.Parser docparser ) {
-               this.parse_comment_helper ( docparser, CommentContext.STRUCT );
+               if ( this.documentation != null )
+                       return ;
+
+               if ( this.parent_class != null ) {
+                       stdout.printf ( "{>>>>>[%s]<<<<<}\n", this.parent_class.comment_string );
+               }
+
+
+               if ( this.comment_string != null ) {
+                       bool tmp = Parser.is_documentation ( this.comment_string );
+                       if ( tmp == true ) {
+                               if ( Parser.is_inherit_doc ( this.comment_string ) && this.parent_class != null ) {
+                                       this.parent_class.parse_comments ( docparser );
+                                       this.documentation = this.parent_class.documentation;
+                               }
+                               else {
+                                       this.parse_comment_helper ( docparser, CommentContext.STRUCT );
+                               }
+                       }
+               }
+
                this.parse_construction_method_comments ( docparser );
                this.parse_constant_comments ( docparser );
                this.parse_field_comments ( docparser );
index d093ed3775e18c6ef964ebb68fb8adbd115a3d47..a496f3fe2f332765766e356ec48d72ef784213db 100644 (file)
@@ -733,6 +733,54 @@ public class Parser : Object {
        }
 
        public DocumentationTree? parse ( Valadoc.Tree tree, Valadoc.Basic me, string str2 ) {
+               if ( me is Valadoc.Property ) {
+                       stdout.printf ( "PROPERTY\n" );
+               }
+               else if ( me is Valadoc.Signal ) {
+                       stdout.printf ( "SIGNAL\n" );
+               }
+               else if ( me is Valadoc.Class ) {
+                       stdout.printf ( "CLASS\n" );
+               }
+               else if ( me is Valadoc.Interface ) {
+                       stdout.printf ( "INTERFACE\n" );
+               }
+               else if ( me is Valadoc.Delegate ) {
+                       stdout.printf ( "DELEGATE\n" );
+               }
+               else if ( me is Valadoc.Namespace ) {
+                       stdout.printf ( "NAMESPACE\n" );
+               }
+               else if ( me is Valadoc.Method ) {
+                       stdout.printf ( "METHOD\n" );
+               }
+               else if ( me is Valadoc.Field ) {
+                       stdout.printf ( "FIELD\n" );
+               }
+               else if ( me is Valadoc.Constant ) {
+                       stdout.printf ( "CONSTANT\n" );
+               }
+               else if ( me is Valadoc.Struct ) {
+                       stdout.printf ( "STRUCT\n" );
+               }
+               else if ( me is Valadoc.Enum ) {
+                       stdout.printf ( "ENUM\n" );
+               }
+               else if ( me is Valadoc.EnumValue ) {
+                       stdout.printf ( "ENUMVALUE\n" );
+               }
+               else if ( me is Valadoc.ErrorCode ) {
+                       stdout.printf ( "ERRORCODE\n" );
+               }
+               else if ( me is Valadoc.ErrorDomain ) {
+                       stdout.printf ( "ERRORDOMAIN\n" );
+               }
+               else {
+                       stdout.printf ( "Gut ^_^\n" );
+               }
+
+               stdout.printf ( "============= %s =============\n", me.full_name() );
+
                string str = str2;
 
                GLib.StringBuilder buf = new GLib.StringBuilder ();
@@ -743,9 +791,10 @@ public class Parser : Object {
 
 
                bool tmp = this.skip_documentation_header ( ref str, ref linenr, ref pos );
-               if ( tmp == false )
+               if ( tmp == false ) {
+               stdout.printf ( "-----------------------\n" );
                        return null;
-
+               }
 
                Gee.ArrayList<Taglet> content = new Gee.ArrayList<Taglet> ();
                string? currtagname = null;
@@ -795,6 +844,7 @@ public class Parser : Object {
 
                                InlineTaglet itag = this.parse_bracket ( tree, me, ref str, ref linestart, ref linestartnr, ref linenr, ref pos );
                                if ( itag == null ) {
+               stdout.printf ( "-----------------------\n" );
                                        return null;
                                }
                                content.add ( itag );
@@ -803,6 +853,7 @@ public class Parser : Object {
                        else if ( chr == '}' ) {
                                string line = this.extract_line ( linestart );
                                this.reporter.add_error (linenr, pos, linenr, pos, "syntax error.\n", line );
+               stdout.printf ( "-----------------------\n" );
                                return null;
                        }
                        else if ( chr == '@' && prevchr.isspace() ) {
@@ -833,11 +884,12 @@ public class Parser : Object {
                        content.add ( strtag );
                }
 
+               stdout.printf ( "-----------------------\n" );
+
                this.append_new_tag ( tree, me, doctree, currtagname, content, currtagline, currtagstartlinenr, currtagstartpos );
                tmp = this.check_foother ( ref linestart, linenr );
                if ( tmp == false )
                        return null;
-
                return doctree;
        }