| 1008 | |
| 1009 | |
| 1010 | static void repeatstat (LexState *ls, int line) { |
| 1011 | /* repeatstat -> REPEAT block UNTIL cond */ |
| 1012 | int condexit; |
| 1013 | FuncState *fs = ls->fs; |
| 1014 | int repeat_init = luaK_getlabel(fs); |
| 1015 | BlockCnt bl1, bl2; |
| 1016 | enterblock(fs, &bl1, 1); /* loop block */ |
| 1017 | enterblock(fs, &bl2, 0); /* scope block */ |
| 1018 | luaX_next(ls); /* skip REPEAT */ |
| 1019 | chunk(ls); |
| 1020 | check_match(ls, TK_UNTIL, TK_REPEAT, line); |
| 1021 | condexit = cond(ls); /* read condition (inside scope block) */ |
| 1022 | if (!bl2.upval) { /* no upvalues? */ |
| 1023 | leaveblock(fs); /* finish scope */ |
| 1024 | luaK_patchlist(ls->fs, condexit, repeat_init); /* close the loop */ |
| 1025 | } |
| 1026 | else { /* complete semantics when there are upvalues */ |
| 1027 | breakstat(ls); /* if condition then break */ |
| 1028 | luaK_patchtohere(ls->fs, condexit); /* else... */ |
| 1029 | leaveblock(fs); /* finish scope... */ |
| 1030 | luaK_patchlist(ls->fs, luaK_jump(fs), repeat_init); /* and repeat */ |
| 1031 | } |
| 1032 | leaveblock(fs); /* finish loop */ |
| 1033 | } |
| 1034 | |
| 1035 | |
| 1036 | static int exp1 (LexState *ls) { |
no test coverage detected