| 8584 | |
| 8585 | |
| 8586 | static void repeatstat (LexState *ls, int line) { |
| 8587 | /* repeatstat -> REPEAT block UNTIL cond */ |
| 8588 | int condexit; |
| 8589 | FuncState *fs = ls->fs; |
| 8590 | int repeat_init = luaK_getlabel(fs); |
| 8591 | BlockCnt bl1, bl2; |
| 8592 | enterblock(fs, &bl1, 1); /* loop block */ |
| 8593 | enterblock(fs, &bl2, 0); /* scope block */ |
| 8594 | luaX_next(ls); /* skip REPEAT */ |
| 8595 | chunk(ls); |
| 8596 | check_match(ls, TK_UNTIL, TK_REPEAT, line); |
| 8597 | condexit = cond(ls); /* read condition (inside scope block) */ |
| 8598 | if (!bl2.upval) { /* no upvalues? */ |
| 8599 | leaveblock(fs); /* finish scope */ |
| 8600 | luaK_patchlist(ls->fs, condexit, repeat_init); /* close the loop */ |
| 8601 | } |
| 8602 | else { /* complete semantics when there are upvalues */ |
| 8603 | breakstat(ls); /* if condition then break */ |
| 8604 | luaK_patchtohere(ls->fs, condexit); /* else... */ |
| 8605 | leaveblock(fs); /* finish scope... */ |
| 8606 | luaK_patchlist(ls->fs, luaK_jump(fs), repeat_init); /* and repeat */ |
| 8607 | } |
| 8608 | leaveblock(fs); /* finish loop */ |
| 8609 | } |
| 8610 | |
| 8611 | |
| 8612 | static int exp1 (LexState *ls) { |
no test coverage detected