mirror of
https://github.com/CPunch/Cosmo.git
synced 2026-04-06 01:30:03 +00:00
cosmoV_throw() now resets the vm stack as well
also a minor GC bug in cosmoO_newError was fixed. i'm going to try to phase out cosmoM_freezeGC & friends since that would cause hell with this new error handling solution. the only thing still using it is the GC.
This commit is contained in:
@@ -229,14 +229,13 @@ CObjCFunction *cosmoO_newCFunction(CState *state, CosmoCFunction func)
|
||||
|
||||
CObjError *cosmoO_newError(CState *state, CValue err)
|
||||
{
|
||||
CCallFrame *frames = cosmoM_xmalloc(state, sizeof(CCallFrame) * state->frameCount);
|
||||
CObjError *cerror = (CObjError *)cosmoO_allocateBase(state, sizeof(CObjError), COBJ_ERROR);
|
||||
cerror->err = err;
|
||||
cerror->frameCount = state->frameCount;
|
||||
cerror->frames = frames;
|
||||
cerror->parserError = false;
|
||||
|
||||
// allocate the callframe
|
||||
cerror->frames = cosmoM_xmalloc(state, sizeof(CCallFrame) * cerror->frameCount);
|
||||
|
||||
// clone the call frame
|
||||
for (int i = 0; i < state->frameCount; i++)
|
||||
cerror->frames[i] = state->callFrame[i];
|
||||
@@ -762,6 +761,8 @@ const char *cosmoO_typeStr(CObj *obj)
|
||||
return "<function>";
|
||||
case COBJ_CFUNCTION:
|
||||
return "<c function>";
|
||||
case COBJ_ERROR:
|
||||
return "<error>";
|
||||
case COBJ_METHOD:
|
||||
return "<method>";
|
||||
case COBJ_CLOSURE:
|
||||
|
||||
Reference in New Issue
Block a user