lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nwelln...@apache.org
Subject [lucy-commits] [47/50] [abbrv] git commit: refs/heads/master - Fix the invocant type on method typedefs.
Date Fri, 11 Oct 2013 13:32:25 GMT
Fix the invocant type on method typedefs.

Method typedefs, like method invocation inline functions, are defined
for each class in the inheritance chain.  Prior to this fix, the "self"
type in the typedef was the type of the last concrete implementor
rather than the type of the invocant.


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

Branch: refs/heads/master
Commit: c36b887ec8209235bd93fb18fe3c1efabae595ab
Parents: 94697de
Author: Marvin Humphrey <marvin@rectangular.com>
Authored: Mon Sep 30 11:52:32 2013 -0700
Committer: Nick Wellnhofer <wellnhofer@aevum.de>
Committed: Fri Oct 11 15:28:21 2013 +0200

----------------------------------------------------------------------
 clownfish/compiler/src/CFCBindMethod.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/c36b887e/clownfish/compiler/src/CFCBindMethod.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCBindMethod.c b/clownfish/compiler/src/CFCBindMethod.c
index c60cc98..0a2f7c9 100644
--- a/clownfish/compiler/src/CFCBindMethod.c
+++ b/clownfish/compiler/src/CFCBindMethod.c
@@ -88,8 +88,6 @@ S_virtual_method_def(CFCMethod *method, CFCClass *klass) {
     CFCParamList *param_list = CFCMethod_get_param_list(method);
     const char *PREFIX         = CFCClass_get_PREFIX(klass);
     const char *invoker_struct = CFCClass_full_struct_sym(klass);
-    const char *common_struct 
-        = CFCType_get_specifier(CFCMethod_self_type(method));
 
     char *full_meth_sym   = CFCMethod_full_method_sym(method, klass);
     char *full_offset_sym = CFCMethod_full_offset_sym(method, klass);
@@ -125,7 +123,7 @@ S_virtual_method_def(CFCMethod *method, CFCClass *klass) {
         = CFCUtil_sprintf(pattern, PREFIX, full_offset_sym, ret_type_str,
                           full_meth_sym, invoker_struct, params_minus_invoker,
                           full_typedef, full_typedef, full_offset_sym,
-                          maybe_return, common_struct,
+                          maybe_return, invoker_struct,
                           arg_names_minus_invoker);
 
     FREEMEM(full_offset_sym);
@@ -136,11 +134,17 @@ S_virtual_method_def(CFCMethod *method, CFCClass *klass) {
 
 char*
 CFCBindMeth_typedef_dec(struct CFCMethod *method, CFCClass *klass) {
-    const char *params = CFCParamList_to_c(CFCMethod_get_param_list(method));
+    const char *params_minus_invoker
+        = CFCParamList_to_c(CFCMethod_get_param_list(method));
+    while (*params_minus_invoker && *params_minus_invoker != ',') {
+        params_minus_invoker++;
+    }
+    const char *self_struct = CFCClass_full_struct_sym(klass);
     const char *ret_type = CFCType_to_c(CFCMethod_get_return_type(method));
     char *full_typedef = CFCMethod_full_typedef(method, klass);
-    char *buf = CFCUtil_sprintf("typedef %s\n(*%s)(%s);\n", ret_type,
-                                full_typedef, params);
+    char *buf = CFCUtil_sprintf("typedef %s\n(*%s)(%s *self%s);\n", ret_type,
+                                full_typedef, self_struct,
+                                params_minus_invoker);
     FREEMEM(full_typedef);
     return buf;
 }


Mime
View raw message