feat: add va_list version of wrenCall and fix GC bug with return values
- Introduce wrenCallVarArgs as an explicit va_list variant, allowing variadic functions to forward their arguments directly without re-parsing. - Fix a garbage collection issue in wrenCall where return values could be prematurely collected by ensuring proper root handling. - Refactor the call API test to avoid re-entering the VM by moving test execution into an afterLoad callback instead of a foreign method.
This commit is contained in:
+1
-10
@@ -3,7 +3,7 @@
|
||||
#include "call.h"
|
||||
#include "vm.h"
|
||||
|
||||
static void runTests(WrenVM* vm)
|
||||
void callRunTests(WrenVM* vm)
|
||||
{
|
||||
WrenValue* noParams = wrenGetMethod(vm, "main", "Api", "noParams");
|
||||
WrenValue* zero = wrenGetMethod(vm, "main", "Api", "zero()");
|
||||
@@ -39,12 +39,3 @@ static void runTests(WrenVM* vm)
|
||||
wrenReleaseValue(vm, getValue);
|
||||
wrenReleaseValue(vm, value);
|
||||
}
|
||||
|
||||
|
||||
WrenForeignMethodFn callBindMethod(const char* signature)
|
||||
{
|
||||
if (strcmp(signature, "static Api.runTests()") == 0) return runTests;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user