lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject [2/3] lucy-clownfish git commit: Generalize test for whether method can be bound.
Date Tue, 07 Apr 2015 00:31:22 GMT
Generalize test for whether method can be bound.

As with Clownfish functions, the algorithm for determining whether
bindings can be generated automatically for a Clownfish method will
likely the same across all all hosts.


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

Branch: refs/heads/master
Commit: bba99f79024330fb38e9db7f40bf83af6cc75126
Parents: 1892f4f
Author: Marvin Humphrey <marvin@rectangular.com>
Authored: Mon Apr 6 16:48:04 2015 -0700
Committer: Marvin Humphrey <marvin@rectangular.com>
Committed: Mon Apr 6 17:19:44 2015 -0700

----------------------------------------------------------------------
 compiler/src/CFCMethod.c     | 11 +++++++++++
 compiler/src/CFCMethod.h     |  5 +++++
 compiler/src/CFCPerlClass.c  |  2 +-
 compiler/src/CFCPerlMethod.c | 13 +------------
 compiler/src/CFCPerlMethod.h |  5 -----
 5 files changed, 18 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/bba99f79/compiler/src/CFCMethod.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCMethod.c b/compiler/src/CFCMethod.c
index 3173681..5f8c951 100644
--- a/compiler/src/CFCMethod.c
+++ b/compiler/src/CFCMethod.c
@@ -261,6 +261,17 @@ CFCMethod_finalize(CFCMethod *self) {
     return finalized;
 }
 
+int
+CFCMethod_can_be_bound(CFCMethod *method) {
+    /*
+     * Check for
+     * - private methods
+     * - methods with types which cannot be mapped automatically
+     */
+    return !CFCSymbol_private((CFCSymbol*)method)
+           && CFCFunction_can_be_bound((CFCFunction*)method);
+}
+
 void
 CFCMethod_set_host_alias(CFCMethod *self, const char *alias) {
     if (!alias || !alias[0]) {

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/bba99f79/compiler/src/CFCMethod.h
----------------------------------------------------------------------
diff --git a/compiler/src/CFCMethod.h b/compiler/src/CFCMethod.h
index 9baea2b..deff2a3 100644
--- a/compiler/src/CFCMethod.h
+++ b/compiler/src/CFCMethod.h
@@ -107,6 +107,11 @@ CFCMethod_override(CFCMethod *self, CFCMethod *orig);
 CFCMethod*
 CFCMethod_finalize(CFCMethod *self);
 
+/** Test whether bindings should be generated for a method.
+  */
+int
+CFCMethod_can_be_bound(CFCMethod *method);
+
 /**
  * Find the first declaration of the method in the class hierarchy.
  */

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/bba99f79/compiler/src/CFCPerlClass.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCPerlClass.c b/compiler/src/CFCPerlClass.c
index e7263c4..7ff21dc 100644
--- a/compiler/src/CFCPerlClass.c
+++ b/compiler/src/CFCPerlClass.c
@@ -245,7 +245,7 @@ CFCPerlClass_method_bindings(CFCClass *klass) {
         }
 
         // Skip methods that shouldn't be bound.
-        if (!CFCPerlMethod_can_be_bound(method)) {
+        if (!CFCMethod_can_be_bound(method)) {
             continue;
         }
 

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/bba99f79/compiler/src/CFCPerlMethod.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCPerlMethod.c b/compiler/src/CFCPerlMethod.c
index 7d0a7fa..0f6f5ec 100644
--- a/compiler/src/CFCPerlMethod.c
+++ b/compiler/src/CFCPerlMethod.c
@@ -121,17 +121,6 @@ CFCPerlMethod_destroy(CFCPerlMethod *self) {
     CFCPerlSub_destroy((CFCPerlSub*)self);
 }
 
-int
-CFCPerlMethod_can_be_bound(CFCMethod *method) {
-    /*
-     * Check for
-     * - private methods
-     * - methods with types which cannot be mapped automatically
-     */
-    return !CFCSymbol_private((CFCSymbol*)method)
-           && CFCFunction_can_be_bound((CFCFunction*)method);
-}
-
 char*
 CFCPerlMethod_perl_name(CFCMethod *method) {
     // See if the user wants the method to have a specific alias.
@@ -445,7 +434,7 @@ char*
 CFCPerlMethod_callback_def(CFCMethod *method) {
     // Return a callback wrapper that throws an error if there are no
     // bindings for a method.
-    if (!CFCPerlMethod_can_be_bound(method)) {
+    if (!CFCMethod_can_be_bound(method)) {
         return S_invalid_callback_def(method);
     }
 

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/bba99f79/compiler/src/CFCPerlMethod.h
----------------------------------------------------------------------
diff --git a/compiler/src/CFCPerlMethod.h b/compiler/src/CFCPerlMethod.h
index a0fbd83..cf5bc5e 100644
--- a/compiler/src/CFCPerlMethod.h
+++ b/compiler/src/CFCPerlMethod.h
@@ -46,11 +46,6 @@ CFCPerlMethod_init(CFCPerlMethod *self, struct CFCMethod *method);
 void
 CFCPerlMethod_destroy(CFCPerlMethod *self);
 
-/** Test whether bindings should be generated for a method.
-  */
-int
-CFCPerlMethod_can_be_bound(struct CFCMethod *method);
-
 /**
  * Create the Perl name of the method.
  */


Mime
View raw message