Skip to content

Commit

Permalink
Make an inheritance system possible; closes #3
Browse files Browse the repository at this point in the history
  • Loading branch information
earaujoassis committed Nov 3, 2015
1 parent 71cff34 commit 2ef9e4b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions object.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,14 @@ proto_execute_property (void *self,
return NULL;
}

void
proto_set_super (void *self,
const void *reference)
{
proto_object_t *object = (proto_object_t *) self;
object->super = (proto_object_t *) reference;
}

proto_object_t *
proto_init_object ()
{
Expand All @@ -283,6 +291,7 @@ proto_init_object ()
object->del_own_property = &proto_del_own_property;
object->chain = &proto_chain;
object->execute_property = &proto_execute_property;
object->set_super = &proto_set_super;
return object;
}

Expand Down
1 change: 1 addition & 0 deletions proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ typedef struct {
const void *(*del_own_property) (void *self, const char *key);
const void *(*chain) (void *self, const char *keys);
const void *(*execute_property) (void *self, const char *key, const void *arguments);
void (*set_super) (void *self, const void *reference);
} proto_object_t;

typedef struct {
Expand Down

0 comments on commit 2ef9e4b

Please # to comment.