@@ -19794,7 +19794,8 @@ typedef struct BlockEnv {
1979419794 int drop_count; /* number of stack elements to drop */
1979519795 int label_finally; /* -1 if none */
1979619796 int scope_level;
19797- int has_iterator;
19797+ uint8_t has_iterator : 1;
19798+ uint8_t is_regular_stmt : 1; /* i.e. not a loop statement */
1979819799} BlockEnv;
1979919800
1980019801typedef struct JSGlobalVar {
@@ -25763,6 +25764,7 @@ static void push_break_entry(JSFunctionDef *fd, BlockEnv *be,
2576325764 be->label_finally = -1;
2576425765 be->scope_level = fd->scope_level;
2576525766 be->has_iterator = FALSE;
25767+ be->is_regular_stmt = FALSE;
2576625768}
2576725769
2576825770static void pop_break_entry(JSFunctionDef *fd)
@@ -25791,7 +25793,8 @@ static __exception int emit_break(JSParseState *s, JSAtom name, int is_cont)
2579125793 }
2579225794 if (!is_cont &&
2579325795 top->label_break != -1 &&
25794- (name == JS_ATOM_NULL || top->label_name == name)) {
25796+ ((name == JS_ATOM_NULL && !top->is_regular_stmt) ||
25797+ top->label_name == name)) {
2579525798 emit_goto(s, OP_goto, top->label_break);
2579625799 return 0;
2579725800 }
@@ -26355,6 +26358,7 @@ static __exception int js_parse_statement_or_decl(JSParseState *s,
2635526358 label_break = new_label(s);
2635626359 push_break_entry(s->cur_func, &break_entry,
2635726360 label_name, label_break, -1, 0);
26361+ break_entry.is_regular_stmt = TRUE;
2635826362 if (!(s->cur_func->js_mode & JS_MODE_STRICT) &&
2635926363 (decl_mask & DECL_MASK_FUNC_WITH_LABEL)) {
2636026364 mask = DECL_MASK_FUNC | DECL_MASK_FUNC_WITH_LABEL;
0 commit comments