Skip to content

Commit ff64836

Browse files
author
Mike Pall
committed
Fix out-of-scope goto handling in parser.
Many thanks to Demetrios Obenour for tracking down this long-standing bug.
1 parent 3ab9f5a commit ff64836

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/lj_parse.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,12 +1280,14 @@ static void fscope_end(FuncState *fs)
12801280
MSize idx = gola_new(ls, NAME_BREAK, VSTACK_LABEL, fs->pc);
12811281
ls->vtop = idx; /* Drop break label immediately. */
12821282
gola_resolve(ls, bl, idx);
1283+
} else { /* Need the fixup step to propagate the breaks. */
1284+
gola_fixup(ls, bl);
12831285
return;
1284-
} /* else: need the fixup step to propagate the breaks. */
1285-
} else if (!(bl->flags & FSCOPE_GOLA)) {
1286-
return;
1286+
}
1287+
}
1288+
if ((bl->flags & FSCOPE_GOLA)) {
1289+
gola_fixup(ls, bl);
12871290
}
1288-
gola_fixup(ls, bl);
12891291
}
12901292

12911293
/* Mark scope as having an upvalue. */

0 commit comments

Comments
 (0)