You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2011/06/21 03:27:29 UTC

[lucy-commits] svn commit: r1137836 - in /incubator/lucy/trunk/clownfish/src: CFCBindMethod.c CFCMethod.c CFCMethod.h

Author: marvin
Date: Tue Jun 21 01:27:28 2011
New Revision: 1137836

URL: http://svn.apache.org/viewvc?rev=1137836&view=rev
Log:
Cut down on casting to CFCFunction* by introducing wrapper functions.

Modified:
    incubator/lucy/trunk/clownfish/src/CFCBindMethod.c
    incubator/lucy/trunk/clownfish/src/CFCMethod.c
    incubator/lucy/trunk/clownfish/src/CFCMethod.h

Modified: incubator/lucy/trunk/clownfish/src/CFCBindMethod.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/src/CFCBindMethod.c?rev=1137836&r1=1137835&r2=1137836&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/src/CFCBindMethod.c (original)
+++ incubator/lucy/trunk/clownfish/src/CFCBindMethod.c Tue Jun 21 01:27:28 2011
@@ -27,10 +27,8 @@
 
 char*
 CFCBindMeth_typdef_dec(struct CFCMethod *method) {
-    const char *params 
-        = CFCParamList_to_c(CFCFunction_get_param_list((CFCFunction*)method));
-    const char *ret_type
-        = CFCType_to_c(CFCFunction_get_return_type((CFCFunction*)method));
+    const char *params = CFCParamList_to_c(CFCMethod_get_param_list(method));
+    const char *ret_type = CFCType_to_c(CFCMethod_get_return_type(method));
     const char *full_typedef = CFCMethod_full_typedef(method);
     size_t size = strlen(params)
                   + strlen(ret_type)
@@ -44,13 +42,13 @@ CFCBindMeth_typdef_dec(struct CFCMethod 
 
 char*
 CFCBindMeth_abstract_method_def(CFCMethod *method) {
-    CFCParamList *param_list = CFCFunction_get_param_list((CFCFunction*)method);
+    CFCParamList *param_list = CFCMethod_get_param_list(method);
     const char *params = CFCParamList_to_c(param_list);
     const char *full_func_sym 
         = CFCFunction_full_func_sym((CFCFunction*)method);
     const char *vtable_var
         = CFCType_get_vtable_var(CFCMethod_self_type(method));
-    CFCType    *return_type  = CFCFunction_get_return_type((CFCFunction*)method);
+    CFCType    *return_type  = CFCMethod_get_return_type(method);
     const char *ret_type_str = CFCType_to_c(return_type);
     const char *macro_sym    = CFCMethod_get_macro_sym(method);
     

Modified: incubator/lucy/trunk/clownfish/src/CFCMethod.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/src/CFCMethod.c?rev=1137836&r1=1137835&r2=1137836&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/src/CFCMethod.c (original)
+++ incubator/lucy/trunk/clownfish/src/CFCMethod.c Tue Jun 21 01:27:28 2011
@@ -193,8 +193,8 @@ CFCMethod_compatible(CFCMethod *self, CF
     }
 
     // Check return types.
-    CFCType *type       = CFCFunction_get_return_type((CFCFunction*)self);
-    CFCType *other_type = CFCFunction_get_return_type((CFCFunction*)other);
+    CFCType *type       = CFCMethod_get_return_type(self);
+    CFCType *other_type = CFCMethod_get_return_type(other);
     if (CFCType_is_object(type)) {
         // Weak validation to allow covariant object return types.
         if (!CFCType_is_object(other_type)) { return false; }
@@ -387,3 +387,12 @@ CFCMethod_public(CFCMethod *self) {
     return CFCSymbol_public((CFCSymbol*)self);
 }
 
+CFCType*
+CFCMethod_get_return_type(CFCMethod *self) {
+    return CFCFunction_get_return_type((CFCFunction*)self);
+}
+
+CFCParamList*
+CFCMethod_get_param_list(CFCMethod *self) {
+    return CFCFunction_get_param_list((CFCFunction*)self);
+}

Modified: incubator/lucy/trunk/clownfish/src/CFCMethod.h
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/src/CFCMethod.h?rev=1137836&r1=1137835&r2=1137836&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/src/CFCMethod.h (original)
+++ incubator/lucy/trunk/clownfish/src/CFCMethod.h Tue Jun 21 01:27:28 2011
@@ -124,6 +124,12 @@ CFCMethod_get_class_cnick(CFCMethod *sel
 int
 CFCMethod_public(CFCMethod *self);
 
+struct CFCType*
+CFCMethod_get_return_type(CFCMethod *self);
+
+struct CFCParamList*
+CFCMethod_get_param_list(CFCMethod *self);
+
 #ifdef __cplusplus
 }
 #endif