MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / repeatstat

Function repeatstat

lua/lparser.c:1070–1093  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1068
1069
1070static 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
1096static int exp1 (LexState *ls) {

Callers 1

statementFunction · 0.85

Calls 11

luaK_getlabelFunction · 0.85
enterblockFunction · 0.85
luaX_nextFunction · 0.85
chunkFunction · 0.85
check_matchFunction · 0.85
condFunction · 0.85
leaveblockFunction · 0.85
luaK_patchlistFunction · 0.85
breakstatFunction · 0.85
luaK_patchtohereFunction · 0.85
luaK_jumpFunction · 0.85

Tested by

no test coverage detected