diff options
Diffstat (limited to 'clox/src/vm.c')
-rw-r--r-- | clox/src/vm.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/clox/src/vm.c b/clox/src/vm.c index eab8c47..c1f0b90 100644 --- a/clox/src/vm.c +++ b/clox/src/vm.c @@ -108,6 +108,11 @@ static bool call(ObjClosure *closure, int argCount) { static bool callValue(Value callee, int argCount) { if (IS_OBJ(callee)) { switch (OBJ_TYPE(callee)) { + case OBJ_CLASS: { + ObjClass *klass = AS_CLASS(callee); + vm.stackTop[-argCount - 1] = OBJ_VAL(newInstance(klass)); + return true; + } case OBJ_CLOSURE: return call(AS_CLOSURE(callee), argCount); case OBJ_NATIVE: { |