Lazy load class when fetched from Go binding.

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

Branch: refs/heads/master
Commit: 98c71c11583a40d13a108a8d6053fa527a736aa2
Parents: b69087b
Author: Marvin Humphrey <[email protected]>
Authored: Sun Apr 12 09:09:31 2015 -0700
Committer: Marvin Humphrey <[email protected]>
Committed: Wed May 6 14:28:16 2015 -0700

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


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/98c71c11/compiler/src/CFCGoClass.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCGoClass.c b/compiler/src/CFCGoClass.c
index 21e6075..d75eaad 100644
--- a/compiler/src/CFCGoClass.c
+++ b/compiler/src/CFCGoClass.c
@@ -124,6 +124,10 @@ CFCGoClass_singleton(const char *class_name) {
 
 CFCClass*
 CFCGoClass_get_client(CFCGoClass *self) {
+    if (!self->client) {
+        CFCClass *client = CFCClass_fetch_singleton(self->parcel, 
self->class_name);
+        self->client = (CFCClass*)CFCBase_incref((CFCBase*)client);
+    }
     return self->client;
 }
 

Reply via email to