mirror of
https://github.com/CPunch/Cosmo.git
synced 2024-11-05 08:10:05 +00:00
fixed another stack error
This commit is contained in:
parent
65662e94f2
commit
93130ede65
@ -763,7 +763,7 @@ static void popLocals(CParseState *pstate, int toScope) {
|
|||||||
int localsToPop = 0;
|
int localsToPop = 0;
|
||||||
|
|
||||||
while (pstate->compiler->localCount > 0 && pstate->compiler->locals[pstate->compiler->localCount - 1].depth > toScope) {
|
while (pstate->compiler->localCount > 0 && pstate->compiler->locals[pstate->compiler->localCount - 1].depth > toScope) {
|
||||||
Local *local = &pstate->compiler->locals[localsToPop];
|
Local *local = &pstate->compiler->locals[pstate->compiler->localCount - 1];
|
||||||
|
|
||||||
if (local->isCaptured) { // local needs to be closed over so other closures can reference it
|
if (local->isCaptured) { // local needs to be closed over so other closures can reference it
|
||||||
// first though, if there are other locals in queue to pop first, go ahead and pop those :)
|
// first though, if there are other locals in queue to pop first, go ahead and pop those :)
|
||||||
|
@ -171,7 +171,7 @@ COSMOVMRESULT cosmoV_call(CState *state, int args) {
|
|||||||
// execute
|
// execute
|
||||||
if (!cosmoV_execute(state))
|
if (!cosmoV_execute(state))
|
||||||
return COSMOVM_RUNTIME_ERR;
|
return COSMOVM_RUNTIME_ERR;
|
||||||
CValue* result = state->top;
|
CValue* result = state->top - 1;
|
||||||
|
|
||||||
// pop the callframe and return result
|
// pop the callframe and return result
|
||||||
popCallFrame(state);
|
popCallFrame(state);
|
||||||
|
Loading…
Reference in New Issue
Block a user