Fix self type of inherited methods

Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/27681c2c
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/27681c2c
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/27681c2c

Branch: refs/heads/markdown_v2
Commit: 27681c2c33d046d478c35206457b41404ebceb34
Parents: 0cf6770
Author: Nick Wellnhofer <[email protected]>
Authored: Wed Dec 3 20:03:35 2014 +0100
Committer: Nick Wellnhofer <[email protected]>
Committed: Wed Dec 3 20:03:35 2014 +0100

----------------------------------------------------------------------
 compiler/src/CFCCHtml.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/27681c2c/compiler/src/CFCCHtml.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCCHtml.c b/compiler/src/CFCCHtml.c
index d06c823..6c7ef6f 100644
--- a/compiler/src/CFCCHtml.c
+++ b/compiler/src/CFCCHtml.c
@@ -687,6 +687,9 @@ S_html_create_param_list(CFCClass *klass, CFCFunction 
*func) {
     CFCParamList  *param_list = CFCFunction_get_param_list(func);
     CFCVariable  **variables  = CFCParamList_get_variables(param_list);
 
+    const char *cfc_class = CFCBase_get_cfc_class((CFCBase*)func);
+    int is_method = strcmp(cfc_class, "Clownfish::CFC::Model::Method") == 0;
+
     if (!variables[0]) {
         return CFCUtil_strdup("(void);\n");
     }
@@ -695,17 +698,29 @@ S_html_create_param_list(CFCClass *klass, CFCFunction 
*func) {
 
     for (int i = 0; variables[i]; ++i) {
         CFCVariable *variable  = variables[i];
-        CFCType     *type      = CFCVariable_get_type(variable);
-        char        *type_html = S_type_to_html(klass, type);
         const char  *name      = CFCVariable_micro_sym(variable);
 
+        char *type_html;
+        int decremented = false;
+        if (is_method && i == 0) {
+            const char *prefix     = CFCClass_get_prefix(klass);
+            const char *struct_sym = CFCClass_get_struct_sym(klass);
+            const char *pattern    = "<span class=\"prefix\">%s</span>%s*";
+            type_html = CFCUtil_sprintf(pattern, prefix, struct_sym);
+        }
+        else {
+            CFCType *type = CFCVariable_get_type(variable);
+            type_html = S_type_to_html(klass, type);
+            decremented = CFCType_decremented(type);
+        }
+
         result = CFCUtil_cat(result, "\n    ", type_html, " <strong>", name,
                              "</strong>", NULL);
 
         if (variables[i+1]) {
             result = CFCUtil_cat(result, ",", NULL);
         }
-        if (CFCType_decremented(type)) {
+        if (decremented) {
             result = CFCUtil_cat(result,
                     " <span class=\"comment\">// decremented</span>", NULL);
         }

Reply via email to