mirror of
https://github.com/bellard/quickjs.git
synced 2026-03-31 20:28:01 +00:00
Fix stack underflow with generator in iterable (saghul) (#488)
This commit is contained in:
parent
aaf0174e71
commit
69090b969f
@ -28196,8 +28196,7 @@ static __exception int js_parse_for_in_of(JSParseState *s, int label_name,
|
||||
JS_FreeAtom(ctx, var_name);
|
||||
|
||||
if (token_is_pseudo_keyword(s, JS_ATOM_of)) {
|
||||
break_entry.has_iterator = is_for_of = TRUE;
|
||||
break_entry.drop_count += 2;
|
||||
is_for_of = TRUE;
|
||||
if (has_initializer)
|
||||
goto initializer_error;
|
||||
} else if (s->token.val == TOK_IN) {
|
||||
@ -28226,6 +28225,11 @@ static __exception int js_parse_for_in_of(JSParseState *s, int label_name,
|
||||
the TDZ values are in the closures */
|
||||
close_scopes(s, s->cur_func->scope_level, block_scope_level);
|
||||
if (is_for_of) {
|
||||
/* set has_iterator after the iterable expression is parsed so
|
||||
that a yield in the expression does not try to close a
|
||||
not-yet-created iterator */
|
||||
break_entry.has_iterator = TRUE;
|
||||
break_entry.drop_count += 2;
|
||||
if (is_async)
|
||||
emit_op(s, OP_for_await_of_start);
|
||||
else
|
||||
|
||||
Loading…
Reference in New Issue
Block a user