Switch some code over to CFCClass_in_parcel

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

Branch: refs/heads/master
Commit: bea2a98f994e2a2f5d7cfe1dee1f957d3bb8042e
Parents: 821bf0d
Author: Nick Wellnhofer <wellnho...@aevum.de>
Authored: Tue Feb 28 16:42:08 2017 +0100
Committer: Nick Wellnhofer <wellnho...@aevum.de>
Committed: Thu Mar 2 20:08:05 2017 +0100

----------------------------------------------------------------------
 compiler/src/CFCBindSpecs.c | 4 ++--
 compiler/src/CFCClass.c     | 7 +++----
 compiler/src/CFCGo.c        | 2 +-
 compiler/src/CFCGoClass.c   | 2 +-
 4 files changed, 7 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/bea2a98f/compiler/src/CFCBindSpecs.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCBindSpecs.c b/compiler/src/CFCBindSpecs.c
index ee10a50..b8c609a 100644
--- a/compiler/src/CFCBindSpecs.c
+++ b/compiler/src/CFCBindSpecs.c
@@ -160,7 +160,7 @@ CFCBindSpecs_add_class(CFCBindSpecs *self, CFCClass *klass) 
{
         parent_ptr = CFCUtil_strdup("NULL");
     }
     else {
-        if (CFCClass_get_parcel(klass) == CFCClass_get_parcel(parent)) {
+        if (CFCClass_in_same_parcel(klass, parent)) {
             parent_ptr
                 = CFCUtil_sprintf("&%s", CFCClass_full_class_var(parent));
         }
@@ -379,7 +379,7 @@ S_parent_offset(CFCBindSpecs *self, CFCMethod *method, 
CFCClass *klass,
     char *parent_offset = NULL;
     char *parent_offset_sym = CFCMethod_full_offset_sym(method, parent);
 
-    if (CFCClass_get_parcel(parent) == CFCClass_get_parcel(klass)) {
+    if (CFCClass_in_same_parcel(klass, parent)) {
         parent_offset = CFCUtil_sprintf("&%s", parent_offset_sym);
     }
     else {

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/bea2a98f/compiler/src/CFCClass.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCClass.c b/compiler/src/CFCClass.c
index ff4b05c..5308d9d 100644
--- a/compiler/src/CFCClass.c
+++ b/compiler/src/CFCClass.c
@@ -239,7 +239,7 @@ CFCClass_do_create(CFCClass *self, struct CFCParcel *parcel,
 
     // Cache several derived symbols.
 
-    const char *prefix = CFCClass_get_prefix(self);
+    const char *prefix = CFCParcel_get_prefix(parcel);
     self->struct_sym        = CFCUtil_strdup(struct_sym);
     self->full_struct_sym   = CFCUtil_sprintf("%s%s", prefix, struct_sym);
     self->ivars_struct      = CFCUtil_sprintf("%sIVARS", struct_sym);
@@ -251,7 +251,7 @@ CFCClass_do_create(CFCClass *self, struct CFCParcel *parcel,
     self->full_ivars_offset = CFCUtil_sprintf("%s_OFFSET",
                                               self->full_ivars_func);
 
-    const char *PREFIX = CFCClass_get_PREFIX(self);
+    const char *PREFIX = CFCParcel_get_PREFIX(parcel);
     size_t struct_sym_len = strlen(struct_sym);
     char *short_class_var = (char*)MALLOCATE(struct_sym_len + 1);
     size_t i;
@@ -663,11 +663,10 @@ CFCClass_num_member_vars(CFCClass *self) {
 // outside this package.
 size_t
 CFCClass_num_non_package_ivars(CFCClass *self) {
-    CFCParcel *parcel       = CFCClass_get_parcel(self);
     CFCClass  *ancestor     = CFCClass_get_parent(self);
     size_t num_non_package_members = 0;
 
-    while (ancestor && CFCClass_get_parcel(ancestor) == parcel) {
+    while (ancestor && CFCClass_in_same_parcel(ancestor, self)) {
         ancestor = CFCClass_get_parent(ancestor);
     }
     if (ancestor) {

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/bea2a98f/compiler/src/CFCGo.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCGo.c b/compiler/src/CFCGo.c
index 9502384..4a359cc 100644
--- a/compiler/src/CFCGo.c
+++ b/compiler/src/CFCGo.c
@@ -238,7 +238,7 @@ S_gen_autogen_go(CFCGo *self, CFCParcel *parcel) {
         CFCGoClass *class_binding = registry[i];
         CFCClass *client = CFCGoClass_get_client(class_binding);
 
-        if (CFCClass_get_parcel(client) != parcel) {
+        if (!CFCClass_in_parcel(client, parcel)) {
             continue;
         }
 

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/bea2a98f/compiler/src/CFCGoClass.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCGoClass.c b/compiler/src/CFCGoClass.c
index 78b9e72..f62adea 100644
--- a/compiler/src/CFCGoClass.c
+++ b/compiler/src/CFCGoClass.c
@@ -281,7 +281,7 @@ CFCGoClass_gen_ctors(CFCGoClass *self) {
        ) {
         return CFCUtil_strdup("");
     }
-    CFCParcel    *parcel     = CFCClass_get_parcel(self->client);
+    CFCParcel    *parcel     = self->parcel;
     CFCParamList *param_list = CFCFunction_get_param_list(ctor_func);
     CFCType      *ret_type   = CFCFunction_get_return_type(ctor_func);
     const char   *struct_sym = CFCClass_get_struct_sym(self->client);

Reply via email to