[valadoc] Importer: Resolve c::*_finish methods



commit 6b8099e8537df5f2beff8971fbe4d61a05b38c54
Author: Florian Brosch <flo brosch gmail com>
Date:   Tue Aug 27 17:10:35 2013 +0200

    Importer: Resolve c::*_finish methods

 src/libvaladoc/html/htmlrenderer.vala  |    4 ++--
 src/libvaladoc/taglets/tagletlink.vala |   25 +++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 2 deletions(-)
---
diff --git a/src/libvaladoc/html/htmlrenderer.vala b/src/libvaladoc/html/htmlrenderer.vala
index 833fd51..d9f5a21 100644
--- a/src/libvaladoc/html/htmlrenderer.vala
+++ b/src/libvaladoc/html/htmlrenderer.vala
@@ -69,12 +69,12 @@ public class Valadoc.Html.HtmlRenderer : ContentRenderer {
        }
 
        private void write_resolved_symbol_link (Api.Node symbol, string? given_label) {
+               var label = (given_label == null || given_label == "") ? symbol.get_full_name () : 
given_label;
                if (symbol == _container || symbol == _owner) {
                        writer.start_tag ("span", {"css", cssresolver.resolve (symbol)})
-                               .text (symbol.name)
+                               .text (label)
                                .end_tag ("span");
                } else {
-                       var label = (given_label == null || given_label == "") ? symbol.get_full_name () : 
given_label;
                        var url = get_url (symbol);
                        if (url == null) {
                                write_unresolved_symbol_link (label);
diff --git a/src/libvaladoc/taglets/tagletlink.vala b/src/libvaladoc/taglets/tagletlink.vala
index 84bbbef..89ab8c3 100644
--- a/src/libvaladoc/taglets/tagletlink.vala
+++ b/src/libvaladoc/taglets/tagletlink.vala
@@ -30,6 +30,7 @@ public class Valadoc.Taglets.Link : InlineTaglet {
 
        private enum SymbolContext {
                NORMAL,
+               FINISH,
                TYPE
        }
 
@@ -58,6 +59,22 @@ public class Valadoc.Taglets.Link : InlineTaglet {
                        _symbol = api_root.search_symbol_cstr (container, symbol_name);
                        _context = SymbolContext.NORMAL;
 
+                       if (_symbol == null && _symbol_name.has_suffix ("_finish")) {
+                               string tmp = _symbol_name.substring (0, _symbol_name.length - 7);
+
+                               _symbol = api_root.search_symbol_cstr (container, tmp + "_async") as 
Api.Method;
+                               if (_symbol != null && ((Api.Method) _symbol).is_yields) {
+                                       _context = SymbolContext.FINISH;
+                               } else {
+                                       _symbol = api_root.search_symbol_cstr (container, tmp) as Api.Method;
+                                       if (_symbol != null && ((Api.Method) _symbol).is_yields) {
+                                               _context = SymbolContext.FINISH;
+                                       } else {
+                                               _symbol = null;
+                                       }
+                               }
+                       }
+
                        if (_symbol == null) {
                                _symbol = api_root.search_symbol_type_cstr (symbol_name);
                                if (_symbol != null) {
@@ -67,6 +84,10 @@ public class Valadoc.Taglets.Link : InlineTaglet {
 
                        if (_symbol != null) {
                                symbol_name = _symbol.name;
+
+                               if (_context == SymbolContext.FINISH) {
+                                       symbol_name = symbol_name + ".end";
+                               }
                        }
                } else {
                        _symbol = api_root.search_symbol_str (container, symbol_name);
@@ -88,6 +109,10 @@ public class Valadoc.Taglets.Link : InlineTaglet {
 
                // TODO: move typeof () to gtkdoc-importer
                switch (_context) {
+               case SymbolContext.FINISH:
+                       // covered by symbol_name
+                       return link;
+
                case SymbolContext.TYPE:
                        Content.Run content = new Content.Run (Run.Style.MONOSPACED);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]