aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lj_parse.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lj_parse.c b/src/lj_parse.c
index b063da25..8a6eeec6 100644
--- a/src/lj_parse.c
+++ b/src/lj_parse.c
@@ -1752,14 +1752,18 @@ static void parse_break(LexState *ls)
1752{ 1752{
1753 FuncState *fs = ls->fs; 1753 FuncState *fs = ls->fs;
1754 FuncScope *bl; 1754 FuncScope *bl;
1755 BCReg savefr;
1755 int upval = 0; 1756 int upval = 0;
1756 for (bl = fs->bl; bl && !bl->isbreakable; bl = bl->prev) 1757 for (bl = fs->bl; bl && !bl->isbreakable; bl = bl->prev)
1757 upval |= bl->upval; /* Collect upvalues in intervening scopes. */ 1758 upval |= bl->upval; /* Collect upvalues in intervening scopes. */
1758 if (!bl) /* Error if no breakable scope found. */ 1759 if (!bl) /* Error if no breakable scope found. */
1759 err_syntax(ls, LJ_ERR_XBREAK); 1760 err_syntax(ls, LJ_ERR_XBREAK);
1761 savefr = fs->freereg;
1762 fs->freereg = bl->nactvar; /* Shrink slots to help data-flow analysis. */
1760 if (upval) 1763 if (upval)
1761 bcemit_AJ(fs, BC_UCLO, bl->nactvar, 0); /* Close upvalues. */ 1764 bcemit_AJ(fs, BC_UCLO, bl->nactvar, 0); /* Close upvalues. */
1762 jmp_append(fs, &bl->breaklist, bcemit_jmp(fs)); 1765 jmp_append(fs, &bl->breaklist, bcemit_jmp(fs));
1766 fs->freereg = savefr;
1763} 1767}
1764 1768
1765/* Check for end of block. */ 1769/* Check for end of block. */