]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Link to classes rather than constructors if the constructors don’t exist
authorPhilip Withnall <philip@tecnocode.co.uk>
Tue, 14 Aug 2012 22:03:48 +0000 (00:03 +0200)
committerFlorian Brosch <flo.brosch@gmail.com>
Tue, 14 Aug 2012 22:03:48 +0000 (00:03 +0200)
If a link would resolve to a constructor, but that constructor doesn’t
exist, link to the class itself instead.

src/doclets/gtkdoc/commentconverter.vala

index 3b90d482be371c6b509d76d410e05246589fd83a..b758910132d6423805629ea8cd84994e9bc4055b 100644 (file)
@@ -100,7 +100,13 @@ public class Gtkdoc.CommentConverter : ContentVisitor {
 
        public override void visit_symbol_link (SymbolLink sl) {
                if (sl.symbol != null) {
-                       current_builder.append (get_docbook_link (sl.symbol, is_dbus) ?? sl.label);
+                       // If the symbol is a method and it doesn't have a constructor, fall back to linking to the class
+                       if (sl.symbol is Method && ((Method) sl.symbol).is_constructor &&
+                           ((Method) sl.symbol).parent is Class && ((Class) ((Method) sl.symbol).parent).is_abstract) {
+                               current_builder.append (get_docbook_link (((Method) sl.symbol).parent, is_dbus) ?? sl.label);
+                       } else {
+                               current_builder.append (get_docbook_link (sl.symbol, is_dbus) ?? sl.label);
+                       }
                } else {
                        current_builder.append (sl.label);
                }