Fix stack stupidity with generators
This commit is contained in:
parent
8dddcfa2e0
commit
0c08398e4a
@ -1599,7 +1599,7 @@ static void yieldStatement() {
|
||||
} else {
|
||||
expression();
|
||||
}
|
||||
emitByte(OP_YIELD);
|
||||
emitBytes(OP_YIELD, OP_POP);
|
||||
}
|
||||
|
||||
static void tryStatement() {
|
||||
@ -2314,7 +2314,7 @@ static void generatorInner(KrkScanner scannerBefore, Parser parserBefore) {
|
||||
krk_rewindScanner(scannerBefore);
|
||||
parser = parserBefore;
|
||||
expression();
|
||||
emitByte(OP_YIELD);
|
||||
emitBytes(OP_YIELD, OP_POP);
|
||||
krk_rewindScanner(scannerAfter);
|
||||
parser = parserAfter;
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ KRK_METHOD(generator,__call__,{
|
||||
size_t newArgs = stackAfter - stackBefore;
|
||||
self->args = realloc(self->args, sizeof(KrkValue) * (self->argCount + newArgs));
|
||||
self->argCount += newArgs;
|
||||
} else if (stackAfter <= stackBefore) {
|
||||
} else if (stackAfter < stackBefore) {
|
||||
_set_generator_done(self);
|
||||
return OBJECT_VAL(self);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user