Skip to content

Commit 27dfbb3

Browse files
committed
fix: continue next error
1 parent 7d54fad commit 27dfbb3

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/ScriptParser_command.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,7 @@ int ScriptParser::nextCommand() {
556556
if (!last_nest_info->previous || last_nest_info->nest_mode != NestInfo::FOR)
557557
errorAndExit("next: not in for loop\n");
558558

559+
bool isContinue = script_h.isName("continue");
559560
int val;
560561
if (!break_flag) {
561562
val = script_h.getVariableData(last_nest_info->var_no).num;
@@ -567,11 +568,15 @@ int ScriptParser::nextCommand() {
567568

568569
if (break_flag || (last_nest_info->step > 0 && val > last_nest_info->to) ||
569570
(last_nest_info->step < 0 && val < last_nest_info->to)) {
570-
break_flag = 0;
571-
last_nest_info = last_nest_info->previous;
572-
573-
delete last_nest_info->next;
574-
last_nest_info->next = NULL;
571+
if (isContinue) {
572+
// 跳出到 next 去销毁
573+
break_flag = 1;
574+
} else {
575+
break_flag = 0;
576+
last_nest_info = last_nest_info->previous;
577+
delete last_nest_info->next;
578+
last_nest_info->next = NULL;
579+
}
575580
} else {
576581
script_h.setCurrent(last_nest_info->next_script);
577582
current_label_info =

0 commit comments

Comments
 (0)