diff options
Diffstat (limited to 'clox/src/object.c')
-rw-r--r-- | clox/src/object.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/clox/src/object.c b/clox/src/object.c index 2df533e..d4afccc 100644 --- a/clox/src/object.c +++ b/clox/src/object.c @@ -27,6 +27,12 @@ ObjFunction *newFunction() { return function; } +ObjNative *newNative(NativeFn function) { + ObjNative *native = ALLOCATE_OBJ(ObjNative, OBJ_NATIVE); + native->function = function; + return native; +} + static ObjString *allocateString(char *chars, int length, uint32_t hash) { ObjString *string = ALLOCATE_OBJ(ObjString, OBJ_STRING); string->length = length; @@ -81,6 +87,9 @@ void printObject(Value value) { case OBJ_FUNCTION: printFunction(AS_FUNCTION(value)); break; + case OBJ_NATIVE: + printf("<native fn>"); + break; case OBJ_STRING: printf("%s", AS_CSTRING(value)); break; |