mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-11 22:28:45 +01:00
This commit is contained in:
@ -1454,12 +1454,9 @@ WrenInterpretResult wrenInterpret(WrenVM* vm, const char* module,
|
||||
wrenPushRoot(vm, (Obj*)closure);
|
||||
ObjFiber* fiber = wrenNewFiber(vm, closure);
|
||||
wrenPopRoot(vm); // closure.
|
||||
|
||||
WrenInterpretResult result = runInterpreter(vm, fiber);
|
||||
|
||||
vm->fiber = NULL;
|
||||
vm->apiStack = NULL;
|
||||
return result;
|
||||
|
||||
return runInterpreter(vm, fiber);
|
||||
}
|
||||
|
||||
ObjClosure* wrenCompileSource(WrenVM* vm, const char* module, const char* source,
|
||||
|
||||
@ -23,12 +23,16 @@ static void multipleInterpretCalls(WrenVM* vm)
|
||||
// Handles should be valid across calls into Wren code.
|
||||
WrenHandle* absMethod = wrenMakeCallHandle(otherVM, "abs");
|
||||
|
||||
result = wrenInterpret(otherVM, "main", "import \"random\" for Random");
|
||||
correct = correct && (result == WREN_RESULT_SUCCESS);
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
// Calling `wrenEnsureSlots()` before `wrenInterpret()` should not introduce
|
||||
// problems later.
|
||||
wrenEnsureSlots(otherVM, 2);
|
||||
|
||||
result = wrenInterpret(otherVM, "main", "1 + 2");
|
||||
// Calling a foreign function should succeed.
|
||||
result = wrenInterpret(otherVM, "main", "Random.new(12345)");
|
||||
correct = correct && (result == WREN_RESULT_SUCCESS);
|
||||
|
||||
wrenEnsureSlots(otherVM, 2);
|
||||
|
||||
Reference in New Issue
Block a user