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 2015/08/17 22:26:02 UTC

[4/6] lucy-clownfish git commit: Ensure proper Go wrapper for return vals.

Ensure proper Go wrapper for return vals.

Access to the capabilities of a Clownfish object wrapped in a Go object
depends on the Go wrapper being class-specific.  For instance, it does
not suffice to wrap a `*C.cfish_Hash` inside a `clownfish.ObjIMP`,
because you cannot invoke Hash operations on it.

Therefore, use WRAPAny for return values, so that the most specific
wrapper struct gets chosen.


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

Branch: refs/heads/master
Commit: 37aefb596c9967103fb1efb084e53da58fbd20f1
Parents: e2152ee
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Tue Aug 11 12:44:19 2015 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Fri Aug 14 15:36:17 2015 -0700

----------------------------------------------------------------------
 compiler/src/CFCGoFunc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/37aefb59/compiler/src/CFCGoFunc.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCGoFunc.c b/compiler/src/CFCGoFunc.c
index d8a33c8..a1e3bb5 100644
--- a/compiler/src/CFCGoFunc.c
+++ b/compiler/src/CFCGoFunc.c
@@ -287,10 +287,10 @@ CFCGoFunc_return_statement(CFCParcel *parcel, CFCType *return_type,
             }
             char *pattern;
             if (CFCType_incremented(return_type)) {
-                pattern = "\treturn %sWRAP%s(unsafe.Pointer(retvalCF))\n";
+                pattern = "\treturn %sWRAPAny(unsafe.Pointer(retvalCF)).(%s)\n";
             }
             else {
-                pattern = "\treturn %sWRAP%s(unsafe.Pointer(C.cfish_inc_refcount(unsafe.Pointer(retvalCF))))\n";
+                pattern = "\treturn %sWRAPAny(unsafe.Pointer(C.cfish_inc_refcount(unsafe.Pointer(retvalCF)))).(%s)\n";
             }
             statement = CFCUtil_sprintf(pattern, go_package, struct_name);
             FREEMEM(go_type_name);