aboutsummaryrefslogtreecommitdiff
path: root/src/lj_parse.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lj_parse.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/lj_parse.c b/src/lj_parse.c
index 5a44f8db..db3ce8e7 100644
--- a/src/lj_parse.c
+++ b/src/lj_parse.c
@@ -2517,11 +2517,9 @@ static void parse_for_num(LexState *ls, GCstr *varname, BCLine line)
2517*/ 2517*/
2518static int predict_next(LexState *ls, FuncState *fs, BCPos pc) 2518static int predict_next(LexState *ls, FuncState *fs, BCPos pc)
2519{ 2519{
2520 BCIns ins; 2520 BCIns ins = fs->bcbase[pc].ins;
2521 GCstr *name; 2521 GCstr *name;
2522 cTValue *o; 2522 cTValue *o;
2523 if (pc >= fs->bclim) return 0;
2524 ins = fs->bcbase[pc].ins;
2525 switch (bc_op(ins)) { 2523 switch (bc_op(ins)) {
2526 case BC_MOV: 2524 case BC_MOV:
2527 if (bc_d(ins) >= fs->nactvar) return 0; 2525 if (bc_d(ins) >= fs->nactvar) return 0;
@@ -2570,7 +2568,7 @@ static void parse_for_iter(LexState *ls, GCstr *indexname)
2570 assign_adjust(ls, 3, expr_list(ls, &e), &e); 2568 assign_adjust(ls, 3, expr_list(ls, &e), &e);
2571 /* The iterator needs another 3 [4] slots (func [pc] | state ctl). */ 2569 /* The iterator needs another 3 [4] slots (func [pc] | state ctl). */
2572 bcreg_bump(fs, 3+ls->fr2); 2570 bcreg_bump(fs, 3+ls->fr2);
2573 isnext = (nvars <= 5 && predict_next(ls, fs, exprpc)); 2571 isnext = (nvars <= 5 && fs->pc > exprpc && predict_next(ls, fs, exprpc));
2574 var_add(ls, 3); /* Hidden control variables. */ 2572 var_add(ls, 3); /* Hidden control variables. */
2575 lex_check(ls, TK_do); 2573 lex_check(ls, TK_do);
2576 loop = bcemit_AJ(fs, isnext ? BC_ISNEXT : BC_JMP, base, NO_JMP); 2574 loop = bcemit_AJ(fs, isnext ? BC_ISNEXT : BC_JMP, base, NO_JMP);