Make Directory.list() create and return a list from C.
This commit is contained in:
@@ -20,6 +20,9 @@ void wrenDebugPrintStackTrace(ObjFiber* fiber)
|
||||
CallFrame* frame = &fiber->frames[i];
|
||||
ObjFn* fn = wrenUpwrapClosure(frame->fn);
|
||||
|
||||
// Skip over stub functions for calling methods from the C API.
|
||||
if (fn->module == NULL) continue;
|
||||
|
||||
// The built-in core module has no name. We explicitly omit it from stack
|
||||
// traces since we don't want to highlight to a user the implementation
|
||||
// detail of what part of the core module is written in C and what is Wren.
|
||||
|
||||
+9
-2
@@ -1311,23 +1311,30 @@ WrenInterpretResult wrenCall(WrenVM* vm, WrenValue* method)
|
||||
ASSERT(vm->fiber->stackTop - vm->fiber->stack >= fn->arity,
|
||||
"Stack must have enough arguments for method.");
|
||||
|
||||
callFunction(vm, vm->fiber, (Obj*)fn, fn->arity);
|
||||
// Discard any extra temporary slots. We take for granted that the stub
|
||||
// function has exactly one slot for each arguments.
|
||||
vm->fiber->stackTop = &vm->fiber->stack[fn->maxSlots];
|
||||
|
||||
callFunction(vm, vm->fiber, (Obj*)fn, 0);
|
||||
return runInterpreter(vm, vm->fiber);
|
||||
}
|
||||
|
||||
WrenValue* wrenCaptureValue(WrenVM* vm, Value value)
|
||||
{
|
||||
if (IS_OBJ(value)) wrenPushRoot(vm, AS_OBJ(value));
|
||||
|
||||
// Make a handle for it.
|
||||
WrenValue* wrappedValue = ALLOCATE(vm, WrenValue);
|
||||
wrappedValue->value = value;
|
||||
|
||||
if (IS_OBJ(value)) wrenPopRoot(vm);
|
||||
|
||||
// Add it to the front of the linked list of handles.
|
||||
if (vm->valueHandles != NULL) vm->valueHandles->prev = wrappedValue;
|
||||
wrappedValue->prev = NULL;
|
||||
wrappedValue->next = vm->valueHandles;
|
||||
vm->valueHandles = wrappedValue;
|
||||
|
||||
|
||||
return wrappedValue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user