mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-11 22:28:45 +01:00
Handle parameter list checking in closures.
This commit is contained in:
@ -250,7 +250,16 @@ DEF_NATIVE(fiber_yield1)
|
||||
|
||||
static PrimitiveResult callFunction(WrenVM* vm, Value* args, int numArgs)
|
||||
{
|
||||
ObjFn* fn = AS_FN(args[0]);
|
||||
ObjFn* fn;
|
||||
if (IS_CLOSURE(args[0]))
|
||||
{
|
||||
fn = AS_CLOSURE(args[0])->fn;
|
||||
}
|
||||
else
|
||||
{
|
||||
fn = AS_FN(args[0]);
|
||||
}
|
||||
|
||||
if (numArgs < fn->numParams) RETURN_ERROR("Function expects more arguments.");
|
||||
|
||||
return PRIM_CALL;
|
||||
|
||||
Reference in New Issue
Block a user