Pass class to PerlMethod ctor directly
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/ee9fda0c Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/ee9fda0c Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/ee9fda0c Branch: refs/heads/master Commit: ee9fda0c6b31b92bc56798b60053ae74d42be037 Parents: a35d347 Author: Nick Wellnhofer <[email protected]> Authored: Tue Apr 21 10:04:00 2015 +0200 Committer: Nick Wellnhofer <[email protected]> Committed: Thu May 7 21:19:37 2015 +0200 ---------------------------------------------------------------------- compiler/perl/lib/Clownfish/CFC.xs | 5 +++-- compiler/src/CFCPerlClass.c | 2 +- compiler/src/CFCPerlMethod.c | 8 ++++---- compiler/src/CFCPerlMethod.h | 5 +++-- 4 files changed, 11 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/ee9fda0c/compiler/perl/lib/Clownfish/CFC.xs ---------------------------------------------------------------------- diff --git a/compiler/perl/lib/Clownfish/CFC.xs b/compiler/perl/lib/Clownfish/CFC.xs index 627e27a..a894710 100644 --- a/compiler/perl/lib/Clownfish/CFC.xs +++ b/compiler/perl/lib/Clownfish/CFC.xs @@ -2124,10 +2124,11 @@ OUTPUT: RETVAL MODULE = Clownfish PACKAGE = Clownfish::CFC::Binding::Perl::Method SV* -_new(method) +_new(klass, method) + CFCClass *klass CFCMethod *method; CODE: - CFCPerlMethod *self = CFCPerlMethod_new(method); + CFCPerlMethod *self = CFCPerlMethod_new(klass, method); RETVAL = S_cfcbase_to_perlref(self); CFCBase_decref((CFCBase*)self); OUTPUT: RETVAL http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/ee9fda0c/compiler/src/CFCPerlClass.c ---------------------------------------------------------------------- diff --git a/compiler/src/CFCPerlClass.c b/compiler/src/CFCPerlClass.c index 93bf6ae..dad5f72 100644 --- a/compiler/src/CFCPerlClass.c +++ b/compiler/src/CFCPerlClass.c @@ -257,7 +257,7 @@ CFCPerlClass_method_bindings(CFCClass *klass) { * this way allows SUPER:: invocations from Perl-space to work * properly. */ - CFCPerlMethod *meth_binding = CFCPerlMethod_new(method); + CFCPerlMethod *meth_binding = CFCPerlMethod_new(klass, method); size_t size = (num_bound + 2) * sizeof(CFCPerlMethod*); bound = (CFCPerlMethod**)REALLOCATE(bound, size); bound[num_bound] = meth_binding; http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/ee9fda0c/compiler/src/CFCPerlMethod.c ---------------------------------------------------------------------- diff --git a/compiler/src/CFCPerlMethod.c b/compiler/src/CFCPerlMethod.c index 08d01a6..0c2861c 100644 --- a/compiler/src/CFCPerlMethod.c +++ b/compiler/src/CFCPerlMethod.c @@ -94,16 +94,16 @@ static const CFCMeta CFCPERLMETHOD_META = { }; CFCPerlMethod* -CFCPerlMethod_new(CFCMethod *method) { +CFCPerlMethod_new(CFCClass *klass, CFCMethod *method) { CFCPerlMethod *self = (CFCPerlMethod*)CFCBase_allocate(&CFCPERLMETHOD_META); - return CFCPerlMethod_init(self, method); + return CFCPerlMethod_init(self, klass, method); } CFCPerlMethod* -CFCPerlMethod_init(CFCPerlMethod *self, CFCMethod *method) { +CFCPerlMethod_init(CFCPerlMethod *self, CFCClass *klass, CFCMethod *method) { CFCParamList *param_list = CFCMethod_get_param_list(method); - const char *class_name = CFCMethod_get_class_name(method); + const char *class_name = CFCClass_get_name(klass); int use_labeled_params = CFCParamList_num_vars(param_list) > 2 ? 1 : 0; http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/ee9fda0c/compiler/src/CFCPerlMethod.h ---------------------------------------------------------------------- diff --git a/compiler/src/CFCPerlMethod.h b/compiler/src/CFCPerlMethod.h index 72cd286..b16a97e 100644 --- a/compiler/src/CFCPerlMethod.h +++ b/compiler/src/CFCPerlMethod.h @@ -36,13 +36,14 @@ struct CFCClass; struct CFCMethod; CFCPerlMethod* -CFCPerlMethod_new(struct CFCMethod *method); +CFCPerlMethod_new(struct CFCClass *klass, struct CFCMethod *method); /** * @param method A Clownfish::CFC::Model::Method. */ CFCPerlMethod* -CFCPerlMethod_init(CFCPerlMethod *self, struct CFCMethod *method); +CFCPerlMethod_init(CFCPerlMethod *self, struct CFCClass *klass, + struct CFCMethod *method); void CFCPerlMethod_destroy(CFCPerlMethod *self);
