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/05/07 00:18:41 UTC
[15/23] lucy-clownfish git commit: Use IMP func for final method call
from Go.
Use IMP func for final method call from Go.
CGO can't deal with macros, and for a final method which is also novel,
the method invocation symbol is a macro which resolves to the
implementing function. Use the implementing function instead of the
macro alias so that CGO doesn't choke.
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/160d20ea
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/160d20ea
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/160d20ea
Branch: refs/heads/master
Commit: 160d20ea26c01d1d39785ed9104d253082b7241a
Parents: b30e855
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Thu Apr 9 19:55:08 2015 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Wed May 6 14:28:16 2015 -0700
----------------------------------------------------------------------
compiler/src/CFCGoMethod.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/160d20ea/compiler/src/CFCGoMethod.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCGoMethod.c b/compiler/src/CFCGoMethod.c
index b15243f..2575153 100644
--- a/compiler/src/CFCGoMethod.c
+++ b/compiler/src/CFCGoMethod.c
@@ -156,7 +156,13 @@ CFCGoMethod_func_def(CFCGoMethod *self, CFCClass *invoker) {
char *name = CFCGoFunc_go_meth_name(CFCMethod_get_macro_sym(novel_method));
char *first_line = CFCGoFunc_func_start(parcel, name, invoker,
param_list, ret_type, true);
- char *full_meth_sym = CFCMethod_full_method_sym(novel_method, NULL);
+ char *cfunc;
+ if (CFCMethod_novel(self->method) && CFCMethod_final(self->method)) {
+ cfunc = CFCUtil_strdup(CFCMethod_imp_func(self->method));
+ }
+ else {
+ cfunc = CFCMethod_full_method_sym(novel_method, NULL);
+ }
char *cfargs = S_prep_cfargs(invoker, param_list);
@@ -212,11 +218,12 @@ CFCGoMethod_func_def(CFCGoMethod *self, CFCClass *invoker) {
"}\n"
;
char *content = CFCUtil_sprintf(pattern, first_line, maybe_retval,
- full_meth_sym, cfargs, maybe_return);
+ cfunc, cfargs, maybe_return);
FREEMEM(maybe_retval);
FREEMEM(maybe_return);
FREEMEM(ret_type_str);
+ FREEMEM(cfunc);
FREEMEM(cfargs);
FREEMEM(first_line);
FREEMEM(name);