Add wrenAbortFiber().

Thanks, @underscorediscovery!
This commit is contained in:
Bob Nystrom
2016-06-09 19:14:21 -07:00
parent 8657a42c21
commit 59e9eb127e
8 changed files with 55 additions and 1 deletions
+1 -1
View File
@@ -513,7 +513,7 @@ typedef struct
// S[NaN ]1---------------------------------------------------
//
// For singleton values, we just enumerate the different values. We'll use the
// low three bits of the mantissa for that, and only need a couple:
// low bits of the mantissa for that, and only need a few:
//
// 3 Type bits--v
// 0[NaN ]1------------------------------------------------[T]
+7
View File
@@ -927,6 +927,7 @@ static WrenInterpretResult runInterpreter(WrenVM* vm, register ObjFiber* fiber)
case METHOD_FOREIGN:
callForeign(vm, fiber, method->fn.foreign, numArgs);
if (!IS_NULL(fiber->error)) RUNTIME_ERROR();
break;
case METHOD_FN_CALL:
@@ -1660,3 +1661,9 @@ void wrenGetVariable(WrenVM* vm, const char* module, const char* name,
setSlot(vm, slot, moduleObj->variables.data[variableSlot]);
}
void wrenAbortFiber(WrenVM* vm, int slot)
{
validateApiSlot(vm, slot);
vm->fiber->error = vm->apiStack[slot];
}