| 1068 | |
| 1069 | |
| 1070 | static void repeatstat (LexState *ls, int line) { |
| 1071 | /* repeatstat -> REPEAT block UNTIL cond */ |
| 1072 | int condexit; |
| 1073 | FuncState *fs = ls->fs; |
| 1074 | int repeat_init = luaK_getlabel(fs); |
| 1075 | BlockCnt bl1, bl2; |
| 1076 | enterblock(fs, &bl1, 1); /* loop block */ |
| 1077 | enterblock(fs, &bl2, 0); /* scope block */ |
| 1078 | luaX_next(ls); /* skip REPEAT */ |
| 1079 | chunk(ls); |
| 1080 | check_match(ls, TK_UNTIL, TK_REPEAT, line); |
| 1081 | condexit = cond(ls); /* read condition (inside scope block) */ |
| 1082 | if (!bl2.upval) { /* no upvalues? */ |
| 1083 | leaveblock(fs); /* finish scope */ |
| 1084 | luaK_patchlist(ls->fs, condexit, repeat_init); /* close the loop */ |
| 1085 | } |
| 1086 | else { /* complete semantics when there are upvalues */ |
| 1087 | breakstat(ls); /* if condition then break */ |
| 1088 | luaK_patchtohere(ls->fs, condexit); /* else... */ |
| 1089 | leaveblock(fs); /* finish scope... */ |
| 1090 | luaK_patchlist(ls->fs, luaK_jump(fs), repeat_init); /* and repeat */ |
| 1091 | } |
| 1092 | leaveblock(fs); /* finish loop */ |
| 1093 | } |
| 1094 | |
| 1095 | |
| 1096 | static int exp1 (LexState *ls) { |
no test coverage detected