diff --git a/src/vm/wren_core.c b/src/vm/wren_core.c index f3f00277..dee77124 100644 --- a/src/vm/wren_core.c +++ b/src/vm/wren_core.c @@ -246,7 +246,7 @@ DEF_PRIMITIVE(fn_arity) RETURN_NUM(AS_CLOSURE(args[0])->fn->arity); } -static void call(WrenVM* vm, Value* args, int numArgs) +static void call_fn(WrenVM* vm, Value* args, int numArgs) { // We only care about missing arguments, not extras. if (AS_CLOSURE(args[0])->fn->arity > numArgs) @@ -254,7 +254,7 @@ static void call(WrenVM* vm, Value* args, int numArgs) vm->fiber->error = CONST_STRING(vm, "Function expects more arguments."); return; } - + // +1 to include the function itself. wrenCallFunction(vm, vm->fiber, AS_CLOSURE(args[0]), numArgs + 1); } @@ -262,7 +262,7 @@ static void call(WrenVM* vm, Value* args, int numArgs) #define DEF_FN_CALL(numArgs) \ DEF_PRIMITIVE(fn_call##numArgs) \ { \ - call(vm, args, numArgs); \ + call_fn(vm, args, numArgs); \ return false; \ } \